DEV Community

Margaret W.N
Margaret W.N

Posted on

Day 49: How to fix (MERGE_HEAD exists) error and undo a git push

Alt Text
Run into this error, again. I keep forgetting how to fix it so i am documenting this for reference sake.
Solution

  • Abort the merge
git merge --abort
Enter fullscreen mode Exit fullscreen mode
  • Git pull
git pull
Enter fullscreen mode Exit fullscreen mode
  • Resolve the conflict by adding a message, saving and closing the editor.
  • Git push
git push
Enter fullscreen mode Exit fullscreen mode

Undo a git push

To undo a push to github this worked for me.

git push -f origin HEAD^:master
Enter fullscreen mode Exit fullscreen mode

Day 49

Top comments (0)