I'm using Aptana and Git. When I go to create a new branch, the following dialog box shows up.
I was wondering what that 'track' checkbox does, and when it's most appropriate to check it.
I understand the concept of tracking in git, but mostly with files. I don't seem to understand how it applies to new branches being created?
Tracking branches are local branches that have a direct relationship to a remote branch. If you're on a tracking branch and type git pull , Git automatically knows which server to fetch from and which branch to merge in.
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.
New Branches The git branch command can be used to create a new branch. When you want to start a new feature, you create a new branch off main using git branch new_branch . Once created you can then use git checkout new_branch to switch to that branch.
When you're publishing a local branch. You can tell Git to track the newly created remote branch simply by using the -u flag with "git push".
In this case, track
refers to git-checkout's and git-branch's --track
option.
When a local branch is started off a remote-tracking branch, git sets up the branch so that git pull
will appropriately merge from the remote-tracking branch.
From man git-branch
:
-t, --track When creating a new branch, set up configuration to mark the start-point branch as "upstream" from the new branch. This configuration will tell git to show the relationship between the two branches in git status and git branch -v. Furthermore, it directs git pull without arguments to pull from the upstream when the new branch is checked out.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With