简体   繁体   中英

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

Currently the only solution I have found is 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. See example below that has git pull and git push information for local branch master.

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.

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 which will give you the tracking info and whether or not it is up to date.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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