git拉取项目下单个目录 发表于 2019-10-24 | 更新于 2019-11-01 | 分类于 运维技术 > 命令详解 | 阅读次数:2 本文字数: 1.8k | 阅读时长 ≈ 2 分钟有时git库里的东西比较多,我们只希望像SVN一样,只拉取git库的一个目录。例如:基础代码仓库infra-code_ops有很多基础代码,我们只想拉取仓库里nginx-conf目录的文件。复制123456$ git init infra-code_ops-nginx && cd infra-code_ops-nginx //初始化仓库,并进入该目录$ git remote add -f origin http:``//gitlab.xxx.com/ops/infra-code_ops.git //添加远程仓库地址$ git config core.sparsecheckout ``true //开启sparse checkout功能$ echo ``"nginx-conf/"` `>> .git/info/sparse-checkout //将nginx-conf/目录写入到该文件中$ cat .git/info/sparse-checkout //确认查看该文件内容$ git pull origin master //拉取远程master分支阅读全文-------------本文结束感谢您的阅读-------------本文标题:git拉取项目下单个目录文章作者:豌豆多多发布时间:2019年10月24日 - 22:10最后更新:2019年11月01日 - 15:11原始链接:https://wandouduoduo.github.io/articles/25be17f8.html许可协议: 署名-非商业性使用-禁止演绎 4.0 国际 转载请保留原文链接及作者。原创技术分享,您的支持将鼓励我继续创作 打赏 微信支付 支付宝
Related Issues not found
Please contact @wandouduoduo to initialize the comment