git命令发出远程追踪分支的名称 [英] git command to emit name of remote tracking branch

查看:115
本文介绍了git命令发出远程追踪分支的名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要一个命令来发出我所在分支的追踪分支的名称。例如:

  $ git checkout --track -b主题origin / master 
设置分支主题以跟踪远程分支主从原产地。
转换到新分支'topic'
$ git unknown-command
origin / master

是否有这样的命令?

解决方案

b
$ b

  git config分支。< branchname> .remote 

会发出在该远程机器上被跟踪的ref:

  git config branch。< branchname> .merge 

我不相信有一个组合命令会一起发出(至少在正常的Git中,你可以自己创建)。




例如,对于本地 master 分支:

  $ git config branch.master.remote 
原点
$ git config branch.master.merge
refs / heads / master


I'd like a command that emits the name of the tracked branch for the branch I'm on. Something like:

$ git checkout --track -b topic origin/master
Branch topic set up to track remote branch master from origin.
Switched to a new branch 'topic'
$ git unknown-command
origin/master

Is there such a command?

解决方案

Will emit the remote being tracked:

git config branch.<branchname>.remote

Will emit the ref being tracked on that remote:

git config branch.<branchname>.merge

I don't believe that there is a combined command that will emit both together (at least within normal Git; you could always make your own).


For example, for a local master branch:

$ git config branch.master.remote
origin
$ git config branch.master.merge
refs/heads/master

这篇关于git命令发出远程追踪分支的名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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