Tracking in git

git for Beginners

Published: May 26, 2020

When you're working with git, you may run across the term "tracking." I'm going to explain what that term is and why it matters.

Let's jump in.

git is a big part of development because it's one way that developers work together. If you're not sure what git is, why you would use it, how to get it installed, check out some of the other videos in this series.

So, tracking...

It's pretty simple. Tracking are local branches that have a direct relationship with a remote branch. If you have tracking on a branch you can use git push or git pull without having to type everything out ... git push origin new-branch

When you clone a repository, usually it will establish a tracking relationship between your local master branch and master branch on your remote repository.

If you want to download the code from a remote branch and set up tracking all in one swoop, you can use:

1 git checkout --track origin/branch-name

This will create a new branch on your machine with the same name, download the code from the remote repository, and then move you to the new branch on your machine.

Technically, you could set up tracking for a branch on your local machine to point to a branch with a different name on your remote repository...but I wouldn't recommend it.


This industry moves fast, but you can stay up to date:

Receive a weekly email of the Internet's best from articles, to tutorials, to pro tips.