How to "abort" merge in IntelliJ Idea

Happened to me while getting both push and pull failures:

  • "Push to origin/master was rejected"
  • "You have not concluded your merge (MERGE_HEAD exists). Please, commit your changes before you can merge"

To resolve:

  1. Go to "Version Control" window --> "Log" tab.
  2. Right click the previous commit --> "Reset Current Branch to Here..."
  3. In Git reset select "Mixed" (it keeps local changes).
  4. If there are later commits that were already pushed --> Pull from remote and merge as required.
  5. Commit the new changes, and Push to remote.

In the latest versions of IntelliJ (and I suppose other JetBrains products) there is a new option in the "Git branches" menu (bottom right of the screen) conveniently named "Abort Merge"...

Git branches menu