I'm experiencing the following error while trying to git fetch a remote branch:
error: Ref refs/origin/remotes/my-branch is at some-hash but expected another-hash From github.com:my-repository ! some-hash my-branch -> origin/my-branch (unable to update local ref)
I have no idea what the hell just blew up. Any enlightenment?
Solution. Unsure the root cause of the "reference broken". To fix it, delete this file . git/refs/remotes/origin/master , and git fetch to retrieve it back.
You can see the different versions of same code in the two branches. You need to choose which version is the old one. If you want to see the differences in same div, you can run the following command: git diff –color-words master..
git fetch --prune is the best utility for cleaning outdated branches. It will connect to a shared remote repository remote and fetch all remote branch refs. It will then delete remote refs that are no longer in use on the remote repository.
Someone has created another branch with the same name, but different case.
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.
Just cut the evil by its root. Wrong remote branch was deleted and evererything is nice as ever.
For other googlers who get here: this is also another less drastic approach:
Navigate to .git\refs\remotes\origin
directory - delete the master file,
Then do another git pull
and it synchronizes successfully.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With