如何更正我的本地分支正在跟踪的远程分支?

时间:2011-04-14 18:00:17

标签: git

我有本地分支'master'和vam-master',它们分别跟踪远程分支'application / master'和'application / vam-master'。

$ git branch -a
* master
  vam-master
  remotes/application/master
  remotes/application/pvm-master

 $ git branch -r
  m/ds-2.3.1_r1 -> application/master
  application/master
  application/vam-master

但由于某种原因,现在'vam-master'正在跟踪'application / master',而不是'application / vam-master'。我该如何解决? 当我做'git status'时,我得到:

$  git checkout vam-master
Switched to branch 'vam-master'
Your branch and 'application/master' have diverged,
and have 49 and 13 different commit(s) each, respectively.

谢谢。

1 个答案:

答案 0 :(得分:1)

git branch --set-upstream vam-master application/vam-master
git branch --set-upstream master application/master

应该做的伎俩。另请参见git branch的手册页。

另一个选项(不那么优雅)是编辑.git/config并更正那里的条目。