本地分支丢失了远程跟踪分支

时间:2012-04-05 18:23:31

标签: git branch tracking

我之前遇到过一种奇怪的情况。

我刚刚为我的开发和主分支完成了git fetch更新:

From remote-host:my_repo
   f3946b5..c3b2d44  develop    -> origin/develop
   72830fe..14d8be6  master     -> origin/master

我的主分支上的Git状态正确地报告我落后了。但是,在我的开发分支上,并没有迹象表明我落后了:

dumbo:my_repo wade$ git checkout develop
Switched to branch 'develop'
dumbo:my_repo wade$ git status
# On branch develop
nothing to commit (working directory clean)

我确定这是因为我的本地开发分支不再跟踪origin / develop:

dumbo:my_repo wade$ git branch -avv
 * develop                   24f29e2 Updated config
  master                    60d5d8f [origin/master: behind 109] Deploy w/ session_fix
  remotes/origin/HEAD       -> origin/master
  remotes/origin/develop    c3b2d44 Deploy changes
  remotes/origin/master     14d8be6 Deploy changes

现在,我知道我可以使用git branch修复它--set-upstream,但我的问题是,它是如何被破坏的?我当然没有采取任何有意识的行动来删除远程跟踪协会。

我的正常工作流程是:

  (on branch develop)
  git stash (if necessary)
  git fetch
  git merge or git rebase origin/develop
  git checkout master
  git merge origin/master
  git checkout develop

有关哪些操作会导致跟踪分支关联被破坏的任何想法?

1 个答案:

答案 0 :(得分:0)

从这些信息中很难说出来。我猜你不小心删除了分支,当你重新创建它时,你没有表明跟踪。

另一种方法是您可能手动编辑了配置并意外删除了该行。