Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git command to show branch upstream

Tags:

git

git's --help and man page very clearly shows good ways to set upstream for a branch, but I have not found a great way to get the current upstream.

Unfortunately, git branch -v shows only the relationship to the upstream branch, and doesn't tell you what remote the upstream branch is using.

I have a workaround, git config --get branch.branch_name.remote but is there another way?

like image 460
asmacdo Avatar asked Jan 09 '23 02:01

asmacdo


1 Answers

A couple of options.

If you pass in the -v parameter twice then git will print the upstream in addition to the relationship

git branch -vv 

You can also use something like

git name-rev @{u}

Where @{u} is a special git reference for your upstream.

like image 199
Andrew C Avatar answered Jan 18 '23 20:01

Andrew C