There's a remote repository with multiple subdirectories (lib/Android and lib/iOS). Is it possible for me to only subtree in lib/Android?
Asked
Active
Viewed 407 times
3
-
No. You have to clone the entire repository – Sagar Sakre Aug 20 '14 at 02:05
1 Answers
2
Yes you can use sparse checkout
, which was added in git 1.7.0 .
e.g:
Init repo
mkdir git-subdir
cd git-subdir
git init
Enable Sparse Checkouts
git config core.sparsecheckout true
Tell Git which directories you want
echo "some/dir/" >> .git/info/sparse-checkout
Add the remote
git remote add -f origin https://github.com/git/git.git
Pull
git pull origin master

atupal
- 16,404
- 5
- 31
- 42