Last active
March 26, 2020 02:19
-
-
Save hoyangtsai/29a27a97fb6b96a74c7cf86a524fc951 to your computer and use it in GitHub Desktop.
git spare-checkout clone subdirectory
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# create a directory for the project repo | |
mkdir [project_name] && cd [project_name] | |
# initialize git repo | |
git init | |
# enable git subtree checkout | |
git config core.sparsecheckout true | |
# enter a folder name which is checked out | |
echo '[folder_name]' >> .git/info/sparse-checkout | |
# set and fetch the git repository | |
git remote add -f origin [git_repo_url] | |
# pull out the files | |
git pull origin [branch_name] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment