克隆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
相关推荐
2401_868534785 小时前
指令集-最常用 Linux 命令速查手册(整合版)
linux·网络协议
ltl5 小时前
小文件问题:文件数量如何放大元数据与 I/O 成本
linux
ltl6 小时前
网络延迟优化:Nagle、TCP_NODELAY 与中断亲和
linux
张文君6 小时前
ubuntu26.04从ext4改成mdadm的raid1+lvm启动
linux·运维·网络
xx~t6 小时前
嵌入式——进程与线程1
linux·c语言·学习·嵌入式·进程与线程
DevHub7 小时前
QEMU + Busybox 搭建嵌入式 Linux 开发环境:内核编译到启动,30 秒一个迭代
linux·运维·服务器
ouynagda7 小时前
Linux 进程管理详解:从概念到实践
linux·运维·网络
2401_890603407 小时前
Linux 基础文件IO
linux·运维·服务器
tx11208763587 小时前
K8S-pod管理与控制器管理
linux·运维·kubernetes·pod