git克隆 不带目录,git clone,忽略一个目录
I'm trying to test something on a wordpress install. In doing so, I'd like to quickly replicate the repo. However, the upload directory (wp-content/uploads) is massive, so I'd like to ignore it.Note:
I'm trying to test something on a wordpress install. In doing so, I'd like to quickly replicate the repo. However, the upload directory (wp-content/uploads) is massive, so I'd like to ignore it.
Note: I don't want to .gitignore this directory all the time, just for this scenario.
Basically, I'd like a command like this pseudo code: git clone --ignore wp-content/uploads.
Is the best way to add that directory to .gitignore, clone, and then revert .gitignore? Or is there a better method?
解决方案
A bit late to the party, but: Don't you want a sparse checkout?
mkdir && cd
git init
git remote add –f
Enable sparse-checkout:
git config core.sparsecheckout true
Configure sparse-checkout by listing your desired sub-trees in .git/info/sparse-checkout:
echo some/dir/ >> .git/info/sparse-checkout
echo another/sub/tree >> .git/info/sparse-checkout
Checkout from the remote:
git pull
更多推荐
所有评论(0)