克隆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
相关推荐
M78佐菲6 小时前
c语言学习笔记:排序与查找方法整理
linux·c语言·笔记·学习·算法
ltl7 小时前
QUIC 协议拆解(上):为什么 TCP 改不动了
linux
Linux-lucky8 小时前
28-Linux学习之旅之Maven与Nexus制品库
linux·运维·学习·nginx·tomcat·maven
捣鼓软件9 小时前
告别“玄学咒语“:这个 GitHub 项目把 GPT-Image2 的提示词变成了“可复用代码“!
gpt·github
dong_junshuai10 小时前
每天一个开源项目#79 Apache Maka:3K星本地Agent工作台
开源·github·agent
峰向AI11 小时前
Apache Maka:解决 AI 最大痛点,对话工具调用全部本地有据可查
github
敲代码还房贷11 小时前
VMware17 + Ubuntu22.04 共享 完整步骤
linux·python·ubuntu
King of fraud11 小时前
Linux 下 MySQL 基础操作:创建用户、数据库与权限管理实战
linux·数据库·mysql
实心儿儿12 小时前
Linux —— 传输层协议TCP
linux·服务器·tcp/ip
前端Hardy12 小时前
GitHub 243K+Star!这个项目给 AI 装上了完整工程体系
github