简体   繁体   English

Git显示本地分支的推拉信息

[英]Git display pull and push information of local branch

What I'm interested in is seeing which branch master is configured to push to and pull from? 我感兴趣的是看到配置了哪个分支主设备来进行推送和从中进行提取? I'm using git version 1.9.3 我正在使用git版本1.9.3

Currently the only solution I have found is git remote show [remote] . 目前,我发现的唯一解决方案是git remote show [remote] Which if run on a remote which is conntected for pull and push for the local branch will give the information. 如果在连接了本地分支的push和push的远程服务器上运行,它将提供信息。 See example below that has git pull and git push information for local branch master. 请参阅下面的示例,该示例具有本地分支主机的git pull和git push信息。

I find this a little cumbersome both because it is indirect, not asking the local branch and if you have multiple remotes configured 我觉得这有点麻烦,因为它是间接的,不询问本地分支,也不询问您是否配置了多个遥控器

git remote show origin
* remote origin
  Fetch URL: [repository-url]
  Push  URL: [repository-url]
  HEAD branch: master
  Remote branches:
    master                               tracked
  Local branch configured for 'git pull':
    master rebases onto remote master
  Local ref configured for 'git push':
    master pushes to master (up to date)

I don't understand what information you are wanting it to show you. 我不明白您要显示什么信息。 THe following commands will you show the minimum information you seem to be asking for. 以下命令将显示您似乎需要的最少信息。 You can replace "master" with any local branch, and "origin" with any remote alias. 您可以用任何本地分支替换“ master”,并用任何远程别名替换“ origin”。

git config --get branch.master.remote
origin
git config --get branch.master.merge
refs/heads/master
git config --get remote.origin.url
/some/path/to/origin/

Another option might be git branch -vv | grep BRANCH 另一个选项可能是git branch -vv | grep BRANCH git branch -vv | grep BRANCH which will give you the tracking info and whether or not it is up to date. git branch -vv | grep BRANCH ,它将为您提供跟踪信息以及是否为最新信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM