克隆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
相关推荐
wangjialelele10 小时前
Linux匿名管道和命名管道以及共享内存
linux·运维·网络
禁默10 小时前
Linux 之从硬件硬盘到文件系统的全面过渡
linux·运维·服务器
塵觴葉11 小时前
Linux内核网络的连接跟踪conntrack简单分析
linux·网络·conntrack
掘我的金11 小时前
Text2Light 安装案例:从 GPU 可用到 OpenEXR 报错,再到顺利出图(Windows + Conda)
github
m0_4646082611 小时前
监控 Linux 服务器资源
linux
tongsound11 小时前
ros2 lifcycle介绍
linux·c++
☆璇11 小时前
【Linux】Linux环境基础开发工具使用
linux·运维·服务器
杨杨杨大侠11 小时前
第3章:实现基础事件总线
java·github·eventbus
杨杨杨大侠11 小时前
第4章:添加注解支持
java·github·eventbus
libokaifa11 小时前
C++ 基础学习
前端·架构·github