克隆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
相关推荐
!沧海@一粟!2 小时前
麒麟Zabbix Agent安装配置全攻略
linux·服务器·zabbix
似水এ᭄往昔6 小时前
【Linux】自动化构建-make/Makefile
linux·运维·服务器·ubuntu
顶点多余7 小时前
Linux“信号“从硬件到软件详解
linux·运维·服务器
瀚高PG实验室8 小时前
rpm包安装报错:cannot open Packages index using db5 - Cannot allocate memory (12)
linux·运维·服务器·瀚高数据库
AI+程序员在路上8 小时前
嵌入式软件技术大全
linux·开发语言·arm开发·单片机
Snasph8 小时前
在Ubuntu上进行端口转发
linux·运维·ubuntu
SeanDe9 小时前
Linux grep 命令用法详解
linux·服务器·网络
W.W.H.9 小时前
Linux共享文件夹不显示,每次都要重新加载问题解决
linux·运维·服务器
你挚爱的强哥10 小时前
解决:动态文本和背景色一致导致文字看不清楚,用js获取背景图片主色调,并获取对比度最大的hex色值给文字
前端·javascript·github
2401_8357925410 小时前
Linux复习笔记
linux·服务器·笔记