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

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

当我执行 git branch -r 时,我看到以下内容:

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

但是当我这样做时 git branch -a 我看到以下内容:

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

为什么我也没有看到 git branch -r 列出的分支?当您执行 git branch -r 时,是否从路径名中删除了 remotes/ 因为它们都是远程的?毫米。

是的。 :)

-r 仅显示远程跟踪分支。 -a 同时显示远程跟踪和本地分支。因为你只有一个本地分支(master)。此分支是您的输出中的唯一区别。

是的。使用 -a 远程跟踪分支被明确标记为远程,而使用 -r 已经很清楚那些是远程分支。