开发者

How to git-pull all but one folder

Is there any way to git pull all f开发者_运维百科olders 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!


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜