Git: What is a tracking branch?

Posted by jerhinesmith on Stack Overflow See other posts from Stack Overflow or by jerhinesmith
Published on 2011-01-14T16:50:26Z Indexed on 2011/01/14 16:53 UTC
Read the original article Hit count: 222

Filed under:
|
|

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)?

© Stack Overflow or respective owner

Related posts about git

Related posts about version-control