如何在不下载回购记录的情况下克隆回购记录(由于文件大小),又如何保留远程分支的知识?

时间:2019-01-11 14:44:55

标签: git github

有没有一种方法可以克隆存储库而不下载存储库历史记录(由于磁盘空间),而且还可以保留远程分支的知识?

我尝试做git clone xxxxxxxxx.git --depth 1,但是当我尝试签出其他分支时,git甚至在git fetch --all之后都不知道它们存在于远程。

2 个答案:

答案 0 :(得分:2)

here所述,除非指定--single-branch,否则使用深度表示--no-single-branch。 尝试添加--no-single-branch

整个命令是:

git clone xxxxxxxxx.git --depth 1 --no-single-branch --shallow-submodules

答案 1 :(得分:0)

使用有关深度(here)的git文档,我完成的命令如下:

git clone xxxxxxxxx.git --depth 1 --no-single-branch --shallow-submodules

相关问题