git只clone仓库中指定的目录

git init 

要拉去的分支

git remote add -f origin http://xxxxx.git   
git config core.sparsecheckout true   #开启sparse clone

设置pull的目录 dir 是远端的目录

echo "dir" >> .git/info/sparse-checkout   
more .git/info/sparse-checkout

pull 到本地

 git pull origin master  

你可能感兴趣的:(git只clone仓库中指定的目录)