What is a tracking branch?

Can someone explain a “tracking branch” as it applies to git?

Here’s the definition from git-scm.com:

A ‘tracking branch’ in Git is a local
branch that is connected to a remote
branch. When you push and pull on that
branch, it automatically pushes and
pulls to the remote branch that it is
connected with.

Use this if you always pull from the
same upstream branch into the new
branch, and if you don’t want to use
“git pull” explicitly.

Unfortunately, being new to git and coming from SVN, that definition makes absolutely no sense to me.

I’m reading through “The Pragmatic Guide to Git” (great book, by the way), and they seem to suggest that tracking branches are a good thing and that after creating your first remote (origin, in this case), you should set up your master branch to be a tracking branch, but it unfortunately doesn’t cover why a tracking branch is a good thing or what benefits you get by setting up your master branch to be a tracking branch of your origin repository.

Can someone please enlighten me (in English)?

7 Answers
7

Leave a Comment