Created
March 30, 2016 10:02
-
-
Save bluebycode/7b6ba55cb2f932b24d6227b2df14757b to your computer and use it in GitHub Desktop.
Working with desired subtrees on git (sparse-checkout)
This file contains 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
# Initialize | |
# Go project folder (empty) and initialize as git | |
git init | |
# Fetch tree | |
git remote add -f origin http://github.com/vrandkode/scratch.git | |
# Enable sparse-checkout and configure by listing your desired sub-trees | |
git config core.sparsecheckout true | |
echo "path/to/dir" >> .git/info/sparse-checkout | |
echo "path/to/some/file" >> .git/info/sparse-checkout | |
# Checkout from branch repo [remote] [branch] | |
git pull origin master | |
# Done | |
# If you later decide to change which directories you would like checked out, | |
# simply edit the sparse-checkout file and run git read-tree again as above | |
# http://schacon.github.io/git/git-read-tree.html#_sparse_checkout | |
git read-tree -mu HEAD | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment