克隆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
相关推荐
徐小夕14 小时前
我们用1万行Vue3代码,做了款开源AI PPT项目
github
苏同学16 小时前
LangGraph 实战:从零实现多工具协作的可追溯文档问答 Agent
github
逛逛GitHub17 小时前
给 OpenClaw 小龙虾🦞搞个像素办公室,这个 GitHub 项目有趣啊。
github
xlp666hub20 小时前
Leetcode第五题:用C++解决盛最多水的容器问题
linux·c++·leetcode
张宏23621 小时前
原子操作 (基于Linux 应用层 C 语言)
linux
doup智能AI21 小时前
数据分析师:报表自动生成与洞察——AI 员工系列 Vol.4
github
答案answer21 小时前
Three.js3D编辑器必备的相机视图插件
开源·github·three.js
RickeyBoy1 天前
Git Worktree / Worktrunk:并行 AI 开发工作流实战
github·vibecoding
kymjs张涛2 天前
OpenClaw 学习小组:初识
android·linux·人工智能
逛逛GitHub2 天前
55 个 AI Agent 组成虚拟公司开源,2 天就 1 万星
github