克隆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
相关推荐
miofly15 分钟前
Genie 4新增原生音频,实时世界模型加入声音生成
开源·github
dong_junshuai1 小时前
每天一个开源项目#155 MuJoCo:从接触求解到控制时序的物理引擎
github
程序员初一1 小时前
Linux 远程桌面有四种做法
linux·ssh
GitHub实测笔记1 小时前
eza 本机实测:一万文件 -l 中位 48ms、ls 21.5ms;脚本里裸跑 eza 输出为空
github
一条Go1 小时前
开源新生代雷达 · 第 04 期
github
一条Go1 小时前
告警指纹:一次故障为什么只产生一条 FIRING 记录
后端·架构·github
wyxspark1 小时前
在本地 AI 中实现绝对可复现:一份 12,810 条哈希的硬核工程记录
github
简创AIGC陶先生1 小时前
【直播切片工作台】第31章:任务接口与任务服务
github
程序开发阿元1 小时前
1C1G 能跑什么:把留常驻服务和不留摆进一张内存表
linux·ssh
xbzb4 小时前
自定义 yum 软件源:Linux 上 createrepo,Windows 上纯 Python 也能造
linux·运维·windows·python·yum·createrepo