Git稀疏檢出
Git在1.7版本后,已經(jīng)支持只Checkout部分內(nèi)容竞川,這個功能叫做 sparse checkout(稀疏檢出)侄非。
git pull 的時候,需要使用 --allow-unrelated-histories:
$ git pull origin master --allow-unrelated-histories
此時流译,除了sparse checkout中的逞怨,其他都不會拉取下來。
(參考錯誤問題:git pull 失敗 ,提示:fatal: refusing to merge unrelated histories
)
git無法pull倉庫refusing to merge unrelated histories
- 當 sparse checkout (如: path1/ path2/ )福澡,
git pull origin master --allow-unrelated-histories
將忽略此外的其他項目 - 修改時叠赦,建議只修改 path1 或 path2 的內(nèi)容
通過:
git add .
git commit -m "ok"
git push -u origin master
來提交 - 當修改了 sparse checkout,通過:
git checkout master
來重新檢出(會更新本地項目)