克隆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
相关推荐
Crazy________1 小时前
40nginx从单节点 HTTPS 到集群负载均衡
linux·运维·服务器
悟空码字4 小时前
部署Spring Boot项目到Linux服务器数据盘
linux·spring boot·部署·数据盘
Once_day6 小时前
Linux之rsyslog(6)RainerScript
linux·服务器·syslog
Shylock_Mister7 小时前
Linux C线程编程全指南
linux·运维·c语言
心灵宝贝7 小时前
CentOS 7 安装 unzip-6.0-21.el7.x86_64.rpm 步骤详解(附安装包)
linux·服务器·centos
q***13347 小时前
在linux(Centos)中Mysql的端口修改保姆级教程
linux·mysql·centos
Starry_hello world7 小时前
Linux 文件缓冲区
linux
牢七8 小时前
操作系统。
linux
SongYuLong的博客8 小时前
openwrt源码编译环境搭建-安装Luci
linux·嵌入式硬件
熙客8 小时前
Linux:监控命令
linux·运维