正如我所看到的,git --track
和--set-upstream-to
修改了一個分支,因此它變成了一個跟蹤(或上游)分支。但我無法理解的細微差別在哪裏。該--track
記錄「遠程分支軌道地方」:git「--track」和「--set-upstream-to」有什麼區別?
$ 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
雖然--set-upstream-to
紀錄「的本地分支軌道遠程分支」:
$ 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
這是什麼兩者之間的區別?我確信「跟蹤分支」是一個簡單的概念,其中額外的upstream
分支內的指針跟蹤head
指定分支在remote
存儲庫中的位置。但似乎更復雜?