ThinkChat🤖让你学习和工作更高效,注册即送10W Token,即刻开启你的AI之旅 广告
[TOC] ## sparse-checkout 只 pull 指定目录 ``` $ git init <project> $ cd <project> $ git remote add origin ssh://<user>@<repository's url> $ git config core.sparsecheckout true $ echo "path1/" >> .git/info/sparse-checkout $ echo "path2/" >> .git/info/sparse-checkout $ git pull origin master ``` 如果本地已经建了版本库 ``` $ git config core.sparsecheckout true $ echo "path1/" >> .git/info/sparse-checkout $ echo "path2/" >> .git/info/sparse-checkout $ git checkout master ``` ## sparse-checkout 文件设置 1. 子目录的匹配 ``` /docs/ 带根斜线,则匹配根目录下的docs docs/ 不带根斜线,匹配所有目录下的docs, 如 test/docs ``` 2.通配符 “*“ (星号) ``` *docs/ index.* *.gif ``` 3. 排除项 “!” (感叹号) ``` /* !/docs/ 只排除 docs ```