克隆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
相关推荐
三言老师5 小时前
K8s集群运行时自动化运维全覆盖落地实操(下)
linux·运维·服务器·网络
ltl6 小时前
HAProxy HTX 与 HTTP 路径:内部表示、改写落点与协议分叉
linux
ltl6 小时前
可拆分 OS:CXL 内存池化如何动摇本地 DRAM 假设
linux
ltl6 小时前
Tetragon 强制执行:Override 与 SIGKILL 各自保证什么
linux
lengjingzju7 小时前
编译与调试完全指南—第6章 性能分析工具
linux
躺不平的理查德8 小时前
嵌入式 Linux 系统移植与 SD 卡量产镜像制作
linux·运维·服务器
问天_观心9 小时前
零基础在windows环境下的WSL使用llamafactory(二)
人工智能·神经网络·语言模型·github·模型蒸馏
一直走下去-明9 小时前
centos7无法安装tcpreplay
linux·运维
吹什么轩9 小时前
linux网络:TCP套接字基础
linux·网络·tcp/ip