克隆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
相关推荐
RickeyBoy6 小时前
Git Worktree / Worktrunk:并行 AI 开发工作流实战
github·vibecoding
kymjs张涛11 小时前
OpenClaw 学习小组:初识
android·linux·人工智能
逛逛GitHub12 小时前
55 个 AI Agent 组成虚拟公司开源,2 天就 1 万星
github
程序设计实验室13 小时前
经历分享,发现挖矿木马后,服务器快速备份与重装(腾讯云平台)
linux
Miku1615 小时前
OpenClaw-Linux+飞书官方Plugin安装指南
linux·人工智能·agent
Miku1615 小时前
OpenClaw 接入 QQ Bot 完整实践指南
linux·人工智能·agent
Tapir16 小时前
被 Karpathy 下场推荐的 NanoClaw 是什么来头
前端·后端·github
ShingingSky16 小时前
用 Claude Skill 改造 AgentTeams:我实现了 AI 协作的质变
github
Moment18 小时前
MinIO已死,MinIO万岁
前端·后端·github
Yogurt_cry20 小时前
[树莓派4B] 闲置近10年的爱普生 L310 打印机爆改无线打印机
linux·物联网·树莓派