简体   繁体   English

为什么`git branch -a`不显示`git branch -r`的分支?

[英]why does `git branch -a` not show branches from `git branch -r`?

When I do git branch -r I see the following: 当我执行git branch -r我看到以下内容:

  origin/HEAD -> origin/master
  origin/master
  origin/<other-branch>

But when I do git branch -a I see the following: 但是当我执行git branch -a我看到以下内容:

* master
  remotes/origin/HEAD -> origin/master
  remotes/origin/master
  remotes/origin/<other-branch>

Why is it that I don't see the branches listed from git branch -r as well? 为什么我也看不到git branch -r列出的git branch -r Is the remotes/ removed from the path name when you do git branch -r because they are all remote? 当您执行git branch -r时,是否从路径名中删除了remotes/ ,因为它们都是远程的? mm. 毫米

Yes. 是。 :) :)

With -r only remote-tracking branches are shown. 使用-r仅显示远程跟踪分支。 With -a both remote-tracking and local branches are shown. 使用-a将显示远程跟踪和本地分支。 Because you have only one local branch (master). 因为您只有一个本地分支(主)。 This branch is the only difference in your outputs. 该分支是您输出中的唯一区别。

And yes. 是的。 With -a remote-tracking branches are explicitly marked as remote, while with -r it is already clear that those are remote branches. 使用-a远程跟踪分支被显式标记为远程分支,而使用-r ,已经清楚地知道它们是远程分支。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM