Git - Remote-tracking branch


Remote-tracking branches are local references to the state of remote branches

  • You can't modify them. They’re just local references that you can’t move.
  • They represent the state of the remote repository the last time you connected to them

They are a local cache of the remote branches.


Remote-tracking branches take the form <remote>/<branch>


Commit History Master

origin/master and remote/master are two remote-tracking branch.


git remote add remote https://aRemoteUrl
  • the remote where fetched with the following statement
git fetch origin
git fetch remote



git branch --remotes
# or
git branch -r
* master


Update the remote tracking branch with the modification on the remote branch

git fetch

git pull is used behind the scene



git branch -rd <remote>/<branchname>


To delete all remote-tracking branches that are stale ie where the corresponding branches on the remote machine no longer exist:

git remote prune <remote>

With git-gui, Remote > Prune

Git Gui Prune Origin


Each remote-tracking branch has a file under .git/refs/<remote>/

Documentation / Reference

Discover More
Git - Clone

git clone creates a clone known as local repository from a remote repository. cloning in git means: downloading the remote repository into a newly created directory setting for each downloaded branch...
Git - Tracking Branch

Tracking branches are local branches that have set their upstream branch. tracking branchreference The local branches have then a direct relationship with their upstream branch that can be: a remote...
Branches Git
Git - Branch

This page talks Branch management in Git. For Git, a branch is: a commit name (ref) that points to the last commit (head) leaf in the commit log (or log) that represents a commit chain Example...
What is a Git Checkout?

With a checkout, you can change the current branch (ie switch branches) or extract files/directory from branches into the working tree (file system directory) files. ie: Restore the file state from...

Share this page:
Follow us:
Task Runner