Skip to content

Instantly share code, notes, and snippets.

@sofyan-ahmad
Last active August 20, 2019 10:43
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 sofyan-ahmad/4ec9cd79c8641bd25479bcea7b73f282 to your computer and use it in GitHub Desktop.
Save sofyan-ahmad/4ec9cd79c8641bd25479bcea7b73f282 to your computer and use it in GitHub Desktop.
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