克隆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
相关推荐
小丑西瓜6662 小时前
CMake基础用法,cmake_minimum_required,project,add_executable
linux·服务器·c++·camke
晚风吹长发2 小时前
初步了解Linux中的命名管道及简单应用和简单日志
linux·运维·服务器·开发语言·数据结构·c++·算法
大熊背2 小时前
多核架构中,RTOS小核跑sensor 的normal模式,大核linux核跑WDR模式,将小核的曝光时间映射到WDR模式中的曝光时间的方法
linux·自动曝光·wdr
全栈测试笔记3 小时前
异步函数与异步生成器
linux·服务器·前端·数据库·python
weixin_462446233 小时前
Linux 下使用 xfreerdp3 远程连接 Windows(从安装到实战使用)
linux·运维·windows
EndingCoder3 小时前
配置 tsconfig.json:高级选项
linux·前端·ubuntu·typescript·json
爱丶狸3 小时前
Linux三剑客之sed
linux·运维·服务器
仗剑恬雅人4 小时前
LINUX数据库高频常用命令
linux·运维·服务器·数据库·ssh·运维开发
Getgit5 小时前
Linux系统的特点有哪些
java·linux·运维·网络·sql
壮哥_icon5 小时前
Ubuntu 虚拟机中编译 Android 源码完整指南(含分卷合并、虚拟内存配置、复制粘贴设置及依赖库安装)
linux·运维·ubuntu