找出本地分支正在跟踪的远程分支 [英] Find out which remote branch a local branch is tracking

查看:74
本文介绍了找出本地分支正在跟踪的远程分支的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


另请参阅:

我怎么让git告诉我哪些分支正在跟踪什么?






如何找出本地分支正在跟踪哪个远程分支?



我需要解析git config的输出,或者是否有一个命令可以为我做这件事? 这里是一个命令,可为您提供跟踪分支:

  $ git branch -vv 
main aaf02f0 [main / master:ahead 25]其他一些提交
* master add0a03 [jdsumsion / master]一些提交

你必须通过SHA和任何长包裹提交消息,但它是快速键入,我得到跟踪分支垂直对齐他的第三栏。




更新

从git 1.8.5版开始,你可以使用 git status git status -sb 显示上游分支。

See also:
how do I get git to show me which branches are tracking what?

How can I find out which remote branch a local branch is tracking?

Do I need to parse git config output, or is there a command that would do this for me?

解决方案

Here is a command that gives you the tracking branch:

$ git branch -vv
  main   aaf02f0 [main/master: ahead 25] Some other commit
* master add0a03 [jdsumsion/master] Some commit

You have to wade through the SHA and any long-wrapping commit messages, but it's quick to type and I get the tracking branches aligned vertically in the 3rd column.


Update

Starting in git version 1.8.5 you can show the upstream branch with git status and git status -sb

这篇关于找出本地分支正在跟踪的远程分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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