克隆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
相关推荐
2601_9561394212 分钟前
广州VI设计公司哪家强
linux·运维·服务器·python
想唱rap40 分钟前
五种IO模型和非阻塞IO
linux·运维·服务器·网络·数据库·tcp/ip
哈哈浩丶2 小时前
存储相关知识①—通用NAND Flash 基础
linux·存储·nand
mzhan0173 小时前
Linux: config: CRYPTO_USER_API_AEAD
linux·安全·module
wangjialelele3 小时前
【SystemV】基于建造者模式的信号量
linux·c语言·c++·算法·建造者模式
源远流长jerry4 小时前
Linux 网络虚拟化深度解析:从 veth 设备对到容器网络实战
linux·运维·服务器·网络·性能优化·php
Larcher4 小时前
# 告别“古法编程”:吴恩达 AI 课程学习笔记与生日贺卡项目实战
前端·github·ai编程
|_⊙4 小时前
Linux 深入理解文件(Ext2文件系统:上)
linux·运维·数据库
kidwjb4 小时前
Linux共享内存
linux·服务器·进程间通信
红茶要加冰4 小时前
七、正则表达式
linux·运维·正则表达式·shell