rxmnnxfpvg
rxmnnxfpvg

Reputation: 30993

How to git-pull all but one folder

Is there any way to git pull all folders in the repository but one? I don't want to create a .gitignore file because other people may want the folder -- it's just too large for me to use right now.

Thanks!

Upvotes: 21

Views: 39117

Answers (2)

cforbish
cforbish

Reputation: 8819

If you want to get just and you could:

mkdir <repo>
cd <repo>
git init
git remote add -f origin <url>
git config core.sparsecheckout true
echo <dir1>/ >> .git/info/sparse-checkout
echo <dir2>/ >> .git/info/sparse-checkout
echo <dir3>/ >> .git/info/sparse-checkout
git pull origin master

I found a good reference here.

Upvotes: 26

VonC
VonC

Reputation: 1323953

I don't think you can do partial pulling, but you can try and see what happen if you pull in a working tree which is not completely checked out.

Since Git1.7, you can do a sparse checkout, as illustrated here, meaning your working tree would explicitly exclude that specific folder when populate its content.

Now if that directory is that big, it may be better to isolate it in an autonomous Git repository, allowing other users to refer to it as a submodule.

Upvotes: 12

Related Questions