Skip to content

Instantly share code, notes, and snippets.

@zafarella
Created June 26, 2018 17:20
Show Gist options
  • Save zafarella/9c57dd54c7a83a8754ead7f8149925b9 to your computer and use it in GitHub Desktop.
Save zafarella/9c57dd54c7a83a8754ead7f8149925b9 to your computer and use it in GitHub Desktop.
git checkout only specific folder
#!/usr/bin/env bash
#
# Checkout only specific folder
#
cd /tmp
rm -rf test && mkdir test && cd test
git init
git remote add origin git@github.com:zafarella/OSX-RAMDisk.git
git config core.sparsecheckout true
echo "Contents/MacOS/*" >> .git/info/sparse-checkout
git pull --depth=1 origin master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment