分支之间的 Git 引用冲突(无法更新本地分支)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19548199/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Git reference conflicts between branches (unable to update local branch)
提问by Alan R. Soares
I'm experiencing the following error while trying to git fetcha remote branch:
我在尝试git fetch远程分支时遇到以下错误:
error: Ref refs/origin/remotes/my-branch is at some-hashbut expected another-hashFrom github.com:my-repository! some-hashmy-branch -> origin/my-branch (unable to update local ref)
错误:Ref refs/origin/remotes/my-branch 是在一些散列但预期另一个散列来自 github.com: my-repository!some-hashmy-branch -> origin/my-branch(无法更新本地引用)
I have no idea what the hell just blew up. Any enlightenment?
我不知道他妈的刚刚爆炸了什么。有什么启示吗?
回答by Alan R. Soares
I've found this error's cause:
我找到了这个错误的原因:
Someone has created another branch with the same name, but different case.
有人创建了另一个名称相同但大小写不同的分支。
What happened?
发生了什么?
Git for windows isn't case sensitive. So, things just got crazy! Git couldn't distinguish one from another, mistaking the hash of each's head.
Windows 版 Git 不区分大小写。所以,事情变得疯狂了!Git 无法区分一个和另一个,误认为每个人的头部的哈希值。
Solution:
解决方案:
Just cut the evil by its root. Wrong remote branch was deleted and evererything is nice as ever.
一刀两断。错误的远程分支被删除了,一切都一如既往的好。
回答by JaredBroad
For other googlers who get here: this is also another less drastic approach:
对于到达这里的其他谷歌员工:这也是另一种不那么激烈的方法:
Navigate to .git\refs\remotes\origin
directory - delete the master file,
导航到.git\refs\remotes\origin
目录 - 删除主文件,
Then do another git pull
and it synchronizes successfully.
然后再做一个git pull
,它同步成功。