What does the "Track?" checkbox do?

Antti Ahola
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 18, 2012

When I push changes to repository the dialog with repository and branch selections have checkboxes that are named "Track?" and have 3 states; empty, checked and "-".

I think they have something to do with git tracking branches feature(?) but why three states, and what those states mean?

2 answers

1 accepted

6 votes
Answer accepted
stevestreeting
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 18, 2012

Checked = Set the remote branch to be the one the local branch should track

Unchecked = Stop the local branch tracking anything

Mixed (-) = Don't change any tracking on this branch, leave it as-is

The latter is the default so that you can push ad-hoc to different remotes / branches from a local branch and not change the tracking setup (neither setting it to a new branch, or unsetting it to stop tracking)

Antti Ahola
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 18, 2012

Thank you. I'm worried if I can accidentally mess up by checking multiple branches, but I'll probably just leave the checkbox as defaut.

Like Shane Ward likes this
stevestreeting
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 18, 2012

No, you can't mess up since each row is a local branch. If you checked multiple branches all it would mean is that each of those local branches would track the remote branch listed next to them (if pushed).

Kent Signorini
Contributor
March 16, 2014

So what does it mean to have the local branch tracking the remote?

Like # people like this
4 votes
bjennings76
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 18, 2014

I was confused about this too, so I did some research.

A 'tracked' branch is the default remote branch for the local branch, so if you use 'git pull' or 'git push', Git knows which remote branch to use.

SourceTree uses the tracked branch to know what state you are in locally. If you switch the 'tracked' branch, SourceTree will show that new branch by default next time you open the push/pull dialogs. SourceTree will also change how it displays the notifications of how many commits ahead/behind your local branch is.

There's more info about Git's tracked branches here:
http://git-scm.com/book/en/Git-Branching-Remote-Branches#Tracking-Branches

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events