Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to show connections between local and remote branches in git?

I'd like to add a copy of a remote branch (origin/featureX) to my local repository.

Therefore I generated a local branch featureX and set it to track the given remote branch:

git branch featureX
git branch -u origin/featureX featureX
# Branch featureX set up to track remote branch featureX from origin.

Now is there a way to show this connection? I tried e.g. git branch -av, but no connection between featureX and remotes/origin/featureX are shown.

like image 633
Edward Avatar asked Dec 02 '22 16:12

Edward


2 Answers

You need to be more verbose git branch -vv, this is documented but not obvious.

-v
-vv
--verbose
When in list mode, show sha1 and commit subject line for each head, along with relationship to upstream branch (if any). If given twice, print the name of the upstream branch, as well (see also git remote show ).

like image 51
Andreas Wederbrand Avatar answered Dec 05 '22 20:12

Andreas Wederbrand


To see the linkage easily, double the -v option:

$ git branch -v
* master   b9a3e01 [ahead 3]
$ git branch -vv
* master   b9a3e01 [origin/master: ahead 3]

See VonC's answer for a more convenient way to get these things started, in most cases.

like image 37
torek Avatar answered Dec 05 '22 20:12

torek