如何查看哪个Git分支正在跟踪哪个远程/上游分支? [英] How can I see which Git branches are tracking which remote / upstream branch?
问题描述
我知道我可以做git branch --all
,它向我显示了本地分支和远程分支,但这对显示它们之间的关系没有多大作用.
I know I can do git branch --all
, and that shows me both local and remote branches, but it's not that useful in showing me the relationships between them.
如何以显示哪个本地分支正在跟踪哪个远程的方式列出分支?
How do I list branches in a way that shows which local branch is tracking which remote?
推荐答案
非常严格的瓷器命令,如果您希望使用它来编写脚本,则效果不佳:
Very much a porcelain command, not good if you want this for scripting:
git branch -vv # doubly verbose!
请注意,在git 1.8.3中,该上游分支以蓝色显示(请参阅"什么是这个分支跟踪(如果有的话)在git中?)
Note that with git 1.8.3, that upstream branch is displayed in blue (see "What is this branch tracking (if anything) in git?")
如果您想要干净的输出,请参见 arcresu的答案-它使用的是我不相信的瓷器命令是我最初编写此答案的时间,因此它更加简洁,可以与配置为进行重新设置的分支一起使用,而不仅仅是合并.
If you want clean output, see arcresu's answer - it uses a porcelain command that I don't believe existed at the time I originally wrote this answer, so it's a bit more concise and works with branches configured for rebase, not just merge.
这篇关于如何查看哪个Git分支正在跟踪哪个远程/上游分支?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!