克隆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
相关推荐
小晶晶京京7 分钟前
day34-LNMP详解
linux·运维·服务器
画个太阳作晴天8 分钟前
A12预装app
linux·服务器·前端
fengyehongWorld42 分钟前
Linux crontab定时任务
linux·运维
shuangrenlong1 小时前
ubuntu更新chrome版本
linux·chrome·ubuntu
寻月隐君1 小时前
硬核实战:从零到一,用 Rust 和 Axum 构建高性能聊天服务后端
后端·rust·github
碎像1 小时前
Linux上配置环境变量
linux·运维·服务器
敲上瘾2 小时前
Linux系统cgroups资源精细化控制基础
linux·测试工具·docker·压力测试·cgroups
起个昵称吧2 小时前
线程相关编程、线程间通信、互斥锁
linux·算法
sunflower_w3 小时前
linux I2C核心、总线与设备驱动
linux·运维·服务器
Ronin3054 小时前
【Linux系统】进程间通信:System V IPC——共享内存
linux·服务器·system v 共享内存