克隆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 小时前
Linux——孤儿进程&进程调度&大O(1)调度
linux·服务器·ubuntu
HalvmånEver1 小时前
Linux:线程同步
linux·运维·服务器·线程·同步
Zach_yuan1 小时前
自定义协议:实现网络计算器
linux·服务器·开发语言·网络
wdfk_prog2 小时前
[Linux]学习笔记系列 -- [drivers][I2C]I2C
linux·笔记·学习
VekiSon2 小时前
Linux内核驱动——杂项设备驱动与内核模块编译
linux·c语言·arm开发·嵌入式硬件
Y1rong2 小时前
linux之网络
linux
寄存器漫游者2 小时前
Linux 软件编程 - IO 编程
linux·运维·spring
_别来无恙_3 小时前
TFTP的使用Linux
linux·服务器
Zaralike3 小时前
Linux 服务器网络不通排查 SOP(标准操作流程)
linux·服务器·网络
getapi3 小时前
注塑件的费用构成
linux·服务器·ubuntu