As I can see, both git --track and --set-upstream-to modify a branch so it becames a tracking (or upstream) branch. But where is a subtle difference I can't comprehend. The --track records "remote branch tracks local":
$ git checkout foo -b
$ git branch --track origin/retarget
Branch origin/retarget set up to track local branch foo.
$ cat .git/config
[branch "origin/retarget"]
remote = .
merge = refs/heads/foo
While --set-upstream-to records "local branch tracks remote branch":
$ git checkout foo -b
$ git branch --set-upstream-to origin/retarget
Branch foo set up to track remote branch retarget from origin.
$ cat .git/config
[branch "foo"]
remote = origin
merge = refs/heads/retarget
What's the difference between this two? I was sure that "tracking branch" is simple concept with additional upstream pointer inside branch that tracks head position of specified branch in remote repository. But seems it's much more complicated?