git clone --filter=blob:none --no-checkout https://github.com/me/myRepo
cd myRepo
git sparse-checkout init
# Add the expected pattern, to include just a subfolder without top files:
git sparse-checkout set /mySubFolder/
# populate working-tree with only the right files:
git read-tree -mu HEAD
关于局部克隆中的局部优化,如:
git clean --dry-run # consider and tweak results then switch to --force
git gc
git repack -Ad
git prune
使用 Git 2.32(Q22021) ,其中“ git repack -A -d”(< a href = “ https://git-scm.com/docs/git-repack # Document/git-repack.txt--A”rel = “ nofollow noReferrer”> man )在部分克隆中不必要地松开承诺者包中的对象在2.32之前: 固定。
删除冗余的缓存树更新提供了对‘ git read-tree’(< a href = “ https://git-scm.com/docs/git-read-tree”rel = “ nofollow noReferrer”> man )<tree-ish>的实质性性能改进,如在‘ p0006-read-tree-checkout 中添加的测试所示。嘘:
Test before after ---------------------------------------------------------------------- read-tree `br_ballast_plus_1` 3.94(1.80+1.57) 3.00(1.14+1.28) -23.9%