克隆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
相关推荐
_dindong10 小时前
Linux网络编程:结合内核数据结构详谈epoll的工作原理
linux·服务器·网络
了一梨10 小时前
在Ubuntu中配置适配泰山派的交叉编译环境
linux·c语言·ubuntu
buyutang_10 小时前
Linux网络编程:Socket套接字编程概念及常用API接口介绍
linux·服务器·网络·tcp/ip
杨云龙UP10 小时前
从0搭建Oracle ODA NFS异地备份:从YUM源到RMAN定时任务的全流程
linux·运维·数据库·oracle
DN金猿10 小时前
恢复 Linux 上误删除的文件
linux·运维·服务器
远瞻。11 小时前
【环境配置】Ubuntu系统安装cuda
linux·运维·ubuntu
kyle~11 小时前
Linux---<unistd.h>类Unix系统编程核心头文件
linux·运维·unix
python百炼成钢11 小时前
55.Linux ADC框架(IIO续)
linux·运维·服务器·驱动开发
祎直向前11 小时前
重装Ubuntu之后重连VSCode
linux·vscode·ubuntu
buyutang_11 小时前
Linux 网络编程:深度理解网络字节序与主机字节序、大端字节序与小端字节序
linux·运维·网络