我只使用git sparsecheckout对repo文件夹进行版本控制。我按照this博客上的说明操作。我已经有了回购,所以我做的是:
git config core.sparsecheckout true
echo api/ >> .git/info/sparse-checkout
git read-tree -mu HEAD
虽然有效,但它还在项目中添加了其他api
个文件夹,但我只想添加顶级api
文件夹,而不是项目中的所有api
个文件夹。< / p>
知道如何使这项工作吗?
答案 0 :(得分:0)
我确认使用/ api /应该可以。
git sparse-checkout
命令使用的模式格式在git read-tree
中进行了说明,其中前导斜杠引用了根文件夹目录。
参见example here。