Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
537 views
in Technique[技术] by (71.8m points)

git - 如何查看哪些Git分支正在跟踪哪个远程/上游分支?(How can I see which Git branches are tracking which remote / upstream branch?)

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.

(我知道我可以做git branch --all ,这向我展示了本地和远程分支,但它在向我展示它们之间的关系方面没有用。)

How do I list branches in a way that shows which local branch is tracking which remote?

(如何以显示哪个本地分支正在跟踪哪个远程的方式列出分支?)

  ask by joachim translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Very much a porcelain command, not good if you want this for scripting:

(非常多的瓷器命令,如果你想要这个脚本,那就不好了:)

git branch -vv   # doubly verbose!

Note that with git 1.8.3, that upstream branch is displayed in blue (see " What is this branch tracking (if anything) in git? ")

(请注意,对于git 1.8.3,该上游分支以蓝色显示(请参阅git中的这个分支跟踪(如果有的话)是什么? ”))


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.

(如果你想要干净的输出,请参阅arcresu的答案 - 它使用了我最初写这个答案时我不相信的瓷器命令,所以它更简洁,适用于为rebase配置的分支,而不仅仅是合并。)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

Just Browsing Browsing

[2] html - How to create even cell spacing within a

2.1m questions

2.1m answers

60 comments

57.0k users

...