克隆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
相关推荐
我星期八休息20 小时前
网络编程—应用层HTTP协议
linux·运维·开发语言·前端·网络·网络协议·http
ShineWinsu21 小时前
对于Linux:UDPsocket编程基础的解析
linux·运维·网络协议·udp·ip·端口号·进程间通信
hehelm1 天前
AI大模型接入SDK—通用模块设计
linux·开发语言·c++
Ai拆代码的曹操1 天前
K8s Pod Pending 逐层排查:从 FailedScheduling 到 PVC StorageClass 不存在的实战记录
java·linux·kubernetes
wangbing11251 天前
JPA下自定义主键
java·linux·服务器
bush41 天前
正点原子imx6ull-uboot,奇怪的问题
linux·学习
dddwjzx1 天前
嵌入式Linux C应用编程——Framebuffer应用编程
linux·嵌入式
今天也想躺ping1 天前
linux系统移植pjsua库实现sip通话功能
linux·sip·交叉编译
信仰8741 天前
Linux进阶篇01:网络基础配置
linux·网络·php
hkj88081 天前
Linux 总线-设备-驱动(Bus-Device-Driver)完整协作原理
linux·运维·microsoft