克隆clone github上某个项目的子目录

有时会遇到只需要克隆github某个项目的子目录,此时可以使用以下方法实现:

需求示例:

现需要克隆:https://github.com/SingleZombie/DL-Demos项目中的ddim项目

注:ddim项目的地址为:https://github.com/SingleZombie/DL-Demos/tree/master/dldemos/ddim

Step1: git clone --filter=blob:none --no-checkout https://github.com/SingleZombie/DL-Demos
Step2: cd DL-Demos, 即表示进行到该目录
Step3: git sparse-checkout init --cone
Step4: git sparse-checkout set dldemos/ddim, 其中dldemos/ddim表示https://github.com/SingleZombie/DL-Demos这个目录下的相对路径
Step5: git checkout master, 其中master表示分支,可以在github项目中查看,如下图所示:

详细的代码步骤如下:

复制代码
git clone --filter=blob:none --no-checkout https://github.com/SingleZombie/DL-Demos
cd DL-Demos
git sparse-checkout init --cone
git sparse-checkout set dldemos/ddim
git checkout master
相关推荐
Tassel_YUE9 分钟前
非 ansible 主机批量执行命令方法:psssh 和 pscp(随手记)
linux·网络·ssh·scp·ansible
脚踏实地,坚持不懈!17 分钟前
Android 上层卡顿在内核中的反应(基于 Linux v7.2.2)
android·linux·运维
H_oRIZoN_22 分钟前
Linux入门DAY36(TCP 并发服务器)
linux·服务器·tcp/ip
灵晔君27 分钟前
【Linux】基础IO(一)——文件、上层C库文件操作、底层linux原生IO
linux·运维·c语言
Fcy64841 分钟前
Linux下 应⽤层⾃定义协议与序列化(JSON方法)
linux·json
koi77u1 小时前
嵌入式学习————————TCP并发服务器(1)
linux·学习
上学的小垃圾9 小时前
基于docker安装MySQL(openEuler系统)
linux·mysql·docker·容器
一直C10 小时前
Linux网络编程|HTTP协议详解(报文、请求方法、状态码)
linux·http·wireshark·vim·visual studio
Brilliantwxx13 小时前
【Linux】 进程(10) 进程控制深度解析:创建、终止与等待
linux·运维·服务器·c语言·开发语言·网络
欧米欧13 小时前
Linux基础指令上
linux·运维·服务器