克隆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
相关推荐
花阴偷移1 小时前
Ubuntu 22.04版本下配置静态IP
linux·运维·服务器·tcp/ip·ubuntu
weixin_473437231 小时前
Swift4D处理Multi-view dataset记录
linux
霞姐聊IT3 小时前
SR-IOV、MR-IOV 与 SIOV:PCIe虚拟化技术的过去、现在与未来
linux·服务器·虚拟化·pcie
szxinmai主板定制专家4 小时前
电力设备RK3568/RK3576+FPGA,多系统混合部署Linux+RTOS RT-THREAD,强实时性
linux·运维·服务器·人工智能·嵌入式硬件·fpga开发
枕星而眠4 小时前
Linux 四大进程/线程同步锁详解:互斥锁、读写锁、条件变量、文件锁
linux·c语言·后端·ubuntu·学习方法
杖雍皓4 小时前
编程范式的下一次跃迁:深度解析全新的 GitHub Copilot 独立桌面应用
github·copilot
L、2185 小时前
CANN调优工具链全景:从profiler到tensorboard的完整观测体系
linux·运维·服务器·深度学习
j_xxx404_5 小时前
Linux进程信号捕捉与操作系统运行本质深度解析
linux·运维·服务器·开发语言·c++·人工智能·ai
eggrall5 小时前
Linux信号——保存信号
linux·运维·服务器