git拉取单个子目录

初始化一个目录cron(需要拉取的的是code下的cron目录)

git init cron

进入目录
cd cron/


git remote add -f code ssh://git@192.168.1.3:8080/test/test.git


git config core.sparsecheckout true


echo code/cron/ >> .git/info/sparse-checkout (这句是灵魂,是核心,是光,是电,是唯一的神话)


git pull ssh://git@192.168.1.3:8080/test/test.git master (选取分支拉取)

原文地址:https://www.cnblogs.com/wuhuanan/p/11771276.html