Skip to content

Instantly share code, notes, and snippets.

@phatblat
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phatblat/a5caa3bb3a3784f03000 to your computer and use it in GitHub Desktop.
Save phatblat/a5caa3bb3a3784f03000 to your computer and use it in GitHub Desktop.
Git sparse checkout
tmpdir=/tmp/phatblat-images
subdir=images/
remote_git=git://github.com/phatblat/phatblat.github.io.git
remote_https=https://github.com/phatblat/phatblat.github.io.git
mkdir $tmpdir
cd $tmpdir
git init
git remote add -f origin $remote_git || \
git remote set-url origin $remote_https && \
git fetch origin
git config core.sparseCheckout true
echo "$subdir" > .git/info/sparse-checkout
git checkout master
open $subdir
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment