我该如何获取最初以`--branch`选项克隆的给定深度的回购中的所有分支?

时间:2018-10-04 05:37:48

标签: git git-fetch

我克隆了一个这样的仓库:

git clone https://example.com/example.git example --branch=master --depth=3

本地仓库example中唯一可用的远程引用现在为origin/master

我知道还有其他分支,例如featurebug

如何在本地存储库中以origin/featureorigin/bug的形式全部使用它们,而又不获取完整的历史记录(我想要--depth=3)?

这是我尝试过的:

git pull -a --depth=3
git fetch -a --depth=3
git fetch origin feature  # This only generates FETCH_HEAD but not origin/feature

在上述所有尝试之后,git branch -a会显示以下内容:

* master
  remotes/origin/HEAD -> origin/master
  remotes/origin/master

预期:

* master
  remotes/origin/master
  remotes/origin/feature  <<<<<<
  remotes/origin/bug      <<<<<<

0 个答案:

没有答案