Create a gist now

Instantly share code, notes, and snippets.

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