3

There's a remote repository with multiple subdirectories (lib/Android and lib/iOS). Is it possible for me to only subtree in lib/Android?

fobbymaster
  • 1,406
  • 3
  • 14
  • 22

1 Answers1

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