克隆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
相关推荐
ltl1 天前
eBPF 可观测性全景:bcc、bpftrace、libbpf 的工程路径
linux
2401_868534781 天前
数仓开发落地手册
linux·运维
正在走向自律1 天前
使用atop工具监控Linux系统指标
linux·运维·php·实时监控·atop分析内存
果果燕1 天前
实习笔记(一):NFS、Samba、VNC、Git、CMake、systemd、内核、交叉编译
linux·arm开发·c++·笔记·git
yyy(十一月限定版)1 天前
017【入门】最小栈
linux·运维·服务器
不负岁月无痕1 天前
简单理解操作系统结构
java·linux·c语言·开发语言·c++·面试
万少1 天前
我是如何感觉到被时代抛弃的
github
Zguigo1 天前
第25-26讲:计算机操作系统存储管理——分页机制、页表与快表(TLB)
linux·windows·笔记
常乐か1 天前
VMware Workstation Pro 17 搭建 Ubuntu 24.04 完整指南
linux·运维·ubuntu
2401_858286111 天前
OS82.【Linux】设计线程池
java·linux·运维·服务器·开发语言·算法·线程池