克隆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
相关推荐
dyxal1 天前
linux系统安装wps
linux·运维·wps
大家的笔记本1 天前
jetson orin super nano(arm linux系统)上读取大恒图像工业相机(型号MER-050-560U3C)教程
linux·arm开发·相机
九章云极AladdinEdu1 天前
深度学习优化器进化史:从SGD到AdamW的原理与选择
linux·服务器·开发语言·网络·人工智能·深度学习·gpu算力
青草地溪水旁1 天前
Linux epoll 事件模型终极指南:深入解析 epoll_event 与事件类型
linux·epoll
..过云雨1 天前
04.【Linux系统编程】基础开发工具2(makefile、进度条程序实现、版本控制器Git、调试器gdb/cgdb的使用)
linux·笔记·学习
zzzsde1 天前
【Linux】初识Linux
linux·运维·服务器
fouryears_234171 天前
云服务器使用代理稳定与github通信方法
运维·服务器·github
渡我白衣1 天前
Linux网络:应用层协议http
linux·网络·http
pofenx1 天前
使用nps创建隧道,进行内网穿透
linux·网络·内网穿透·nps
Ronin3051 天前
【Linux系统】单例式线程池
linux·服务器·单例模式·线程池·线程安全·死锁