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

时间:2021-05-07 16:27:09

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? Is the remotes/ removed from the path name when you do git branch -r because they are all remote? mm.

为什么我看不到git branch -r中列出的分支呢?当你执行git branch -r时,遥控器/从路径名中移除,因为它们都是远程的吗?毫米。

1 个解决方案

#1


2  

Yes. :)

是。 :)

With -r only remote-tracking branches are shown. With -a both remote-tracking and local branches are shown. Because you have only one local branch (master). This branch is the only difference in your outputs.

使用-r仅显示远程跟踪分支。使用-a远程跟踪和本地分支。因为您只有一个本地分支(主)。这个分支是您输出的唯一区别。

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时,已经很清楚这些分支是远程分支。

#1


2  

Yes. :)

是。 :)

With -r only remote-tracking branches are shown. With -a both remote-tracking and local branches are shown. Because you have only one local branch (master). This branch is the only difference in your outputs.

使用-r仅显示远程跟踪分支。使用-a远程跟踪和本地分支。因为您只有一个本地分支(主)。这个分支是您输出的唯一区别。

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时,已经很清楚这些分支是远程分支。