克隆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
相关推荐
Asus.Blogs10 分钟前
为什么 import _ “github.com/go-sql-driver/mysql“ 要导入但不使用?_ 是什么意思?
sql·golang·github
头疼的程序员16 分钟前
linux入门学习(介绍、常用命令、vim、shell)
linux·vim
lix的小鱼21 分钟前
安装Hadoop并运行WordCount程序
大数据·linux·hadoop
Johny_Zhao38 分钟前
Ubuntu安装部署Zabbix网络监控平台和设备配置添加
linux·网络·mysql·网络安全·信息安全·云计算·apache·zabbix·shell·yum源·系统运维·itsm
chennalC#c.h.JA Ptho1 小时前
kubuntu系统详解
linux·数据库·经验分享·postgresql·系统安全
熙曦Sakura1 小时前
【Linux网络】HTTPS
linux·网络·https
铁锚1 小时前
一个WordPress连续登录失败的问题排查
java·linux·服务器·nginx·tomcat
程序视点2 小时前
Linux中find命令用法核心要点提炼
linux·linux命令·linux指令·linux的find命令
cwywsx2 小时前
Linux:进程控制2
linux·运维·算法
熙曦Sakura2 小时前
【Linux网络】 HTTP cookie与session
linux·网络·http