What is a Tracking Reference?

The basic idea is that there are purely local references (e.g., branches, tags), and then there are remote tracking references, which follow what happens in other repos. Because Git is decentralized, it is possible for you to choose a name for a branch that is the same as one used in a remote, without having known about the other one, such that they have completely different work on them. Git lets you do this, but it also provides a way to link local references to remote ones as well.

For example, consider the following:

% git branch -a
* master
  remotes/origin/HEAD -> origin/master
  remotes/origin/maint
  remotes/origin/master
  remotes/origin/next
  remotes/origin/pu
  remotes/origin/todo

Here we have branches on origin called next and todo.

% git checkout -t remotes/origin/next
Branch next set up to track remote branch next from origin.
Switched to a new branch 'next'
% git branch todo    

Now we have a local branch next that tracks the remote branch of the same name and local branch todo that will not be updated with changes to remotes/origin/todo.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)