Reputation: 5989
what is the different in checkoutCommand in git with upsreamMode is
TRACK,
NOTRACK,
SET_UPSTREAM;
Does it have different meaning when you create or checkout branch ?
Upvotes: 2
Views: 295
Reputation: 521239
From the Git documentation:
When a local branch is started off a remote-tracking branch, Git sets up the branch (specifically the branch..remote and branch..merge configuration entries) so that git pull will appropriately merge from the remote-tracking branch.
Consider the following scenario where there exists a branch called feature
on your Git repository, and you want to create a local branch from it:
git checkout origin/feature
git checkout -b feature
Now the local branch feature
will track changes made to its counterpart in the repository. This means when do a git pull
your local branch can sync up with the remote. But suppose you did not want your local feature
branch to track anything. The Git documentation states:
That setting can be overridden by using the --track and --no-track options, and changed later using git branch --set-upstream-to.
In our example, you would achieve this via:
git checkout origin/feature
git checkout -b --no-track feature
Now when you git pull
your local feature
branch will not be updated.
But suppose you decide later on that you really do want your local feature
branch to track its counterpart on the remote. Then you could use the following:
git checkout feature
git --set-upstream origin/feature
Upvotes: 4