如何查看哪个 Git 分支正在跟踪哪个远程/上游分支? [英] How can I see which Git branches are tracking which remote / upstream branch?

查看:39
本文介绍了如何查看哪个 Git 分支正在跟踪哪个远程/上游分支?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道我可以做 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 的答案 - 它使用了我认为不存在的瓷器命令我最初写这个答案的时间,所以它更简洁一点,并且适用于为 rebase 配置的分支,而不仅仅是合并.

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆