我正在尝试使用--track
或--set-upstream-to
跟踪退出分支到远程分支,但出现以下错误
$ git branch --track master origin/master
fatal: A branch named 'master' already exists.
$ git branch --set-upstream-to master origin/master
fatal: branch 'origin/master' does not exist
我检查了SourceTree,发现它使用了--set-upstream
,但收到了以下警告
$ git branch --set-upstream master origin/master
The --set-upstream flag is deprecated and will be removed. Consider using --track or --set-upstream-to
Branch master set up to track remote branch master from origin.
--track
和--set-upstream-to
都不起作用,我错过了什么吗?
答案 0 :(得分:15)
我想我明白了,它将如下(使用--set-upstream-to + remote name)
$ git branch --set-upstream-to origin/master
Branch master set up to track remote branch master from origin.