Ce ge
Links: https://www.zhihu.com/question/25369412/answer/96174755
Source: Know
Copyright belongs to the author, please contact the author for authorization.
Git1.7.0 later added sparse checkout mode, which makes it possible to specify a file or folder for check out.
The specific implementation is as follows:
$mkdir project_folder$cd project_folder$git init$git remote add -f origin <url>
The code above will help you create an empty local repository and add the remote git Server url to the git config file.
Next, we allow the use of the sparse checkout mode in config:
$git config core.sparsecheckout true
Next you need to tell git which files or folders you really want to check out, and you can save them as a list in the. git/info/sparse-checkout file.
For example:
$echo “libs” >> .git/info/sparse-checkout$echo “apps/register.go” >> .git/info/sparse-checkout$echo “resource/css” >> .git/info/sparse-checkout
Finally, you just have to pull your project down in the normal way from the branch you want:
$git pull origin master
How do I download a single folder on GitHub?