Reputation: 440
Or what's the different between those two commands? What does "tracking" refer to? How about "upstream"? Are the two actions different?
git branch --track [branch] [remote-branch]
git branch --set-upstream [branch] [remote-branch]
thx~
Upvotes: 2
Views: 520
Reputation: 3119
The idea behind both commands is that you'd like to track the changes in a remote branch.
git branch --track [branch] [remote-branch]
Creates a local branch from the remote-branch and sets the remote-branch as its upstream in order to track differences. This is the default behavior when branching off of a remote branch and can be controlled using the branch.autoSetupMerge configuration variable.
git branch --set-upstream [branch] [remote-branch]
Updates the upstream branch of a local branch to track differences to the remote-branch. If the local branch didn't yet exist, the above two commands would be equivalent. The main difference is that --set-upstream doesn't necessarily modify the branch pointer.
For further information, you should review the git branch documentation.
Upvotes: 3