On Linux, how to clone a directory under a specified branch through the git command.
For example, the branch name is master, and there are three directories aa, bb, and cc below. I only need to clone the directory aa. Other directories do not need to be cloned locally.
Thank you so much.
天蓬老师2017-05-02 09:49:50
sparse checkout
mkdir myrepo
cd myrepo
git init
git config core.sparseCheckout true
git remote add -f origin git://...
echo "path/within_repo/to/desired_subdir/*" > .git/info/sparse-checkout
git checkout [branchname] # ex: master
see http://stackoverflow.com/ques...
PHP中文网2017-05-02 09:49:50
Versions before 1.7 are not supported. . There is a sparsecheckout configuration item later, which allows you to clone only some files/directories. In fact, all data is still obtained when pulling, but it is filtered when the local warehouse is updated, so the operation is relatively troublesome.
Search sparse-checkout online for specific operations