简体   繁体   English

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

[英]Local branch lost remote tracking branch

I have a strange situation I haven't encountered before.我有一个以前从未遇到过的奇怪情况。

I've just done git fetch gotten updates for both my develop and master branches:我刚刚为我的开发和主分支完成了 git 获取更新:

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

Git status on my master branch correctly reports that I'm behind.我的主分支上的 Git 状态正确地报告我落后了。 However, on my develop branch, there's no indication that I'm behind:但是,在我的开发分支上,没有迹象表明我落后了:

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)

I determined that it's because my local develop branch is no longer tracking origin/develop:我确定这是因为我本地的 develop 分支不再跟踪 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

Now, I know I can fix it with git branch --set-upstream, but my question is, how did it get clobbered?现在,我知道我可以使用 git branch --set-upstream 修复它,但我的问题是,它是如何被破坏的? I certainly didn't take any conscious action to delete the remote tracking association.我当然没有采取任何有意识的行动来删除远程跟踪关联。

My normal workflow is:我的正常工作流程是:

  (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

Any thoughts on what actions would cause a tracking branch association to get clobbered?关于什么行为会导致跟踪分支协会遭到破坏,有什么想法吗?

It's really hard to tell from this information.从这些信息中真的很难分辨。 I would guess that you accidentally deleted the branch and when you recreated it, you did not indicate tracking.我猜你不小心删除了分支,当你重新创建它时,你没有指示跟踪。

Another way is that you may have edited the config by hand and accidentally deleted the line.另一种方法是您可能手动编辑了配置并意外删除了该行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM