admin管理员组文章数量:1613035
因为全部项目文件太大,而且只对某几个子文件夹感兴趣,印象中git有个sparse-checkout的功能,因此实践一番,遇到了一些问题,以Tensorflow Models 为例分享一下。
Segmentfault的分享
按照爱睡觉的小猫咪
答案所述
git init models && cd models
git config core.sparsecheckout true //设置允许克隆子目录
echo official/resnet/* >> .git/info/sparse-checkout //设置要克隆的仓库的子目录路径
git remote add origin https://github/tensorflow/models
git pull origin master
这种方法的git pull origin master
存疑,我遇到过error: Sparse checkout leaves no entry on the working directory
的错误,按照下一方法的git checkout master
则没有出现错误。
StackOverflow的分享
git clone -n https://github/tensorflow/models
cd tensorflow
git config core.sparsecheckout true
echo official/resnet >> .git/info/sparse-checkout
git checkout master
值得注意的是,无论哪种方法都需要下载.git
文件夹,这是git的元数据存储。 大项目的.git
元数据通常也比较庞大,比如Tensorflow
元数据133.31MB,Models
的元数据243.66MB,下载依然要不少时间。
当想追加子文件夹时,继续echo official/mnist/* >> .git/info/sparse-checkout
再git checkout master
即可。
如有错误或建议,欢迎交流。
本文标签: 文件夹GitWindowscheckoutsparse
版权声明:本文标题:Windows git 利用sparse-checkout 只下载子文件夹 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://www.elefans.com/dongtai/1728649955a1167896.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论