Skip to content

Find out which remote branch a local branch is tracking

Advertisements

To list down all branches that are currently being tracked, we can use the following command.

git branch -av

An example:

> git branch -av


* feature/client                  21e5135 Fixed response for trip status and truck status
  master                          e633095 Merge branch 'master' of https://bitbucket.org/poopcodeteamteam/toolv2-chatbot into release
  remotes/origin/HEAD             -> origin/master
  remotes/origin/develop          1fcfc36 Merged in feature/developer (pull request #60)
  remotes/origin/feature/devops   1d3de6c Merge branch 'develop' of https://bitbucket.org/poopcodeteamteam/toolv2-chatbot into feature/devops
  remotes/origin/feature/client   21e5135 Fixed response for trip status and truck status
  remotes/origin/hotfixes         0846101 conflicts resolved
  remotes/origin/master           e633095 Merge branch 'master' of https://bitbucket.org/poopcodeteamteam/toolv2-chatbot into release
  remotes/origin/release          6b7eeb1 Merged in develop (pull request #54)
Advertisements

To show only the current branch with the tracked files, we can use..

> git status -b --porcelain
## feature/client...origin/feature/client
 M bin/www
 M package.json
 M src/config/logger.js
 M src/routes/wbhook.js
?? back_logs/

Another simple way is to use cat .git/config

> cat .git/config
[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
[remote "origin"]
        url = https://poopcode@bitbucket.org/poopcodeteam/toolv2-chatbot.git
        fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
        remote = origin
        merge = refs/heads/master
[branch "feature/client"]
        remote = origin
        merge = refs/heads/feature/client

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.