克隆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
相关推荐
A小调的码农9 小时前
给垃圾平板“一生E本” 装新系统—————Armbian 编译 KYX T7Y (RK3326) 踩坑全记录
linux·嵌入式硬件
ljs64827395110 小时前
Linux 网络常用命令与端口基础详解
linux·网络·php
白帽小阳10 小时前
Typora插件开发指南:打造专属IDE式写作环境
c语言·网络·python·网络安全·github·pygame·护网行动
bin915310 小时前
使用Docker安装github项目 源码中含有 docker-compose.yml
docker·eureka·github
qq_1631357510 小时前
Linux 判断是否安装 Conda / Miniconda 完整方法
linux
weixin_3077791310 小时前
Linux下Docker Compose里运行Milvus向量数据库故障诊断Shell脚本
linux·运维·数据库·docker·milvus
素心如月桠10 小时前
windows系统使用https://lnmp.org/的LNMP一键安装包,来打开我的服务器Linux
linux·运维·服务器
AOwhisky10 小时前
Linux(CentOS)系统管理入门笔记:第二期核心知识点自测与详解
linux·笔记·centos
运维大师11 小时前
【Linux运维极简教程】03-用户与用户组管理
linux·运维·服务器
云计算-Security11 小时前
同(异)主机 Linux NAT 最佳实践
linux·服务器·网络