【发布时间】:2015-04-29 22:06:42
【问题描述】:
根据Subdirectory Checkouts with git sparse-checkout在已经存在存储库的情况下配置稀疏签出后调用git read-tree -mu HEAD,即:
# Enable sparse-checkout:
git config core.sparsecheckout true
# Configure sparse-checkout
echo some/dir/ >> .git/info/sparse-checkout
echo another/sub/tree >> .git/info/sparse-checkout
# Update your working tree:
git read-tree -mu HEAD
- 能否更详细地解释一下
read-tree步骤? - 它是如何工作的?
- 这是怎么回事?
- 为什么使用
read-tree而不是checkout? - 为什么要使用
-mu(为什么要合并,合并了什么)?
-m
Perform a merge, not just a read. The command will refuse to run if your index file has unmerged entries, indicating that you have not finished previous merge you started.-u
After a successful merge, update the files in the work tree with the result of the merge.
【问题讨论】:
-
注意:对于 Git 2.27,2020 年第二季度,
git read-tree将不再被 git sparse-checkout 调用。见我的edited answer below
标签: git sparse-checkout