I\'m working with a repository with a very large number of files that takes hours to checkout. I\'m looking into the possibility of whether Git would work well with this kin
In my case, I want to skip the Pods
folder when cloning the project. I did step by step like below and it works for me.
Hope it helps.
mkdir my_folder
cd my_folder
git init
git remote add origin -f <URL>
git config core.sparseCheckout true
echo '!Pods/*\n/*' > .git/info/sparse-checkout
git pull origin master
Memo, If you want to skip more folders, just add more line in sparse-checkout file.
I found the answer I was looking for from the one-liner posted earlier by pavek (thanks!) so I wanted to provide a complete answer in a single reply that works on Linux (GIT 1.7.1):
1--> mkdir myrepo
2--> cd myrepo
3--> git init
4--> git config core.sparseCheckout true
5--> echo 'path/to/subdir/' > .git/info/sparse-checkout
6--> git remote add -f origin ssh://...
7--> git pull origin master
I changed the order of the commands a bit but that does not seem to have any impact. The key is the presence of the trailing slash "/" at the end of the path in step 5.