Search code examples
gitbranchgit-branchremote-branch

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.


Solution

  • 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 ).