简体   繁体   English

git branch -a不显示所有远程分支

[英]git branch -a does not show all remote branches

My remote git server has 2 branches, develop and release. 我的远程git服务器有2个分支,开发和发布。

I've cloned the repository, but when I do git branch -a I see: 我克隆了存储库,但是当我做git branch -a我看到:

* develop
  remotes/ghe/HEAD -> ghe/develop
  remotes/ghe/develop

I tried to do a git fetch but it did not update the list. 我试着做一个git fetch但它没有更新列表。

By running git clone with a --depth of 1, you're creating a shallow clone . 通过运行--depth为1的git clone ,您将创建一个浅层克隆 The behavior you saw is the default behavior without specifying --no-single-branch to get the tips of all branches, instead of the most recent single branch. 您看到的行为是默认行为, 没有指定--no-single-branch来获取所有分支的提示,而不是最近的单个分支。 By not specifying this option, you're just getting the primary branch where the remote HEAD is pointing to. 通过不指定此选项,您只需获取远程HEAD指向的主分支。

If you wanted a shallow clone with the tips of all branches the solution would have been to specify the option --no-single-branch . 如果你想要一个带有所有分支提示的浅层克隆,解决方案就是指定选项--no-single-branch

For more information, take a look at the documentation on git clone . 有关更多信息,请查看有关git clone文档。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用 `git branch -a` 列出所有分支不显示最近获取的分支? - List all branches with `git branch -a` does not show recently fetched branch? Git:显示故障分支已合并到的所有远程分支 - Git: Show all remote branches that a faulty branch has been merged into 为什么 git branch --merged 不显示所有合并的分支? - Why does git branch --merged not show all merged branches? 无法检出远程分支,git branch -a也不显示远程分支 - Not able to checkout remote branch, git branch -a also does not show remote branches 为什么`git branch -a`不显示`git branch -r`的分支? - why does `git branch -a` not show branches from `git branch -r`? git fetch 获取有关所有远程分支的信息并且 git pull 执行 git fetch 然后只合并当前分支是否正确? - Is it correct that git fetch gets info about all remote branches and git pull does git fetch then only merges current branch? GitHub GUI 没有列出 git 分支 -a 列出的所有分支 - GitHub GUI does not list all the branches that git branch -a does git是否获取 <remote> 为跟踪该远程的所有本地分支获取它? - Does git fetch <remote> fetch it for all the local branches tracking that remote? 远程git分支没有用`git branch -r`显示? - Remote git branches not shown with `git branch -r`? git 分支未显示所有分支 - git branch is not showing all the branches
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM