http://schacon.github.io/git/git-read-tree.html#_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-checkoutUpdate your working tree:
git read-tree -mu HEAD
可以略过第二步
1. git config core.sparsecheckout true
2 Update your working tree:
git read-tree -mu HEAD 3
git checkout [branch] -- fileName