Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Git Clone Sub-Directory Only
 mkdir {{workdir}}
 cd {{workdir}}
 git init 
 git remote add origin {{gitUrl}}
 git config core.sparseCheckout true
 echo "{{clonedSubdir}}/{{clonedSubSubdir}}" >> .git/info/sparse-checkout
 git pull origin
 git checkout {{workingBranch if not master}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment