节选自
http://jasonkarns.com/blog/subdirectory-checkouts-with-git-sparse-checkout/
Existing Repository
If you already have a repository, simply enable and configure sparse-checkout as above and do git read-tree.
-
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
-
Update your working tree:
git read-tree -mu HEAD