Does "git branch" list all the branches in a repository?

时间:2016-08-31 18:48:24

标签: git

I am looking at the repository where I created a feature branch from the main branch and someone else merged my feature branch into the main branch.

The repository which I am looking at was first created by cloning a github repository and then pulled multiple times from the github repository.

I believe that there are other feature branches created by others. But when I run git branch, it doesn't show the feature branches created by others. What might be the reason for that?

Thanks.

2 个答案:

答案 0 :(得分:2)

默认情况下,

git branch仅列出本地存储库中可用的分支。正如评论中所提到的,你可以传递给它的标志,列出其他分支。

如果评论错误,则建议-ra标记在一起。这实际上是多余的:-r将列出远程跟踪分支,而-a将列出所有分支(本地和远程)。

如果你想了解更多,我会link to the man page for git branch。快乐阅读!

答案 1 :(得分:-1)

尝试Git branch -A它会显示您拥有的所有分支,以及您尚未从github下载的分支