How to "abort" merge in IntelliJ Idea
39,591
Solution 1
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:
- Go to "Version Control" window --> "Log" tab.
- Right click the previous commit --> "Reset Current Branch to Here..."
- In Git reset select "Mixed" (it keeps local changes).
- If there are later commits that were already pushed --> Pull from remote and merge as required.
- Commit the new changes, and Push to remote.
Solution 2
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"...
Related videos on Youtube
Author by
Jaroslav Záruba
Updated on September 18, 2022Comments
-
Jaroslav Záruba over 1 year
Let's say I am merging and just before the push I decide that I do not want to merge. Is it possible to get rid of the commits I have merged (and not pushed yet) without deleting my local branch or going into command line?
-
harrymc over 6 yearsChoose your case from here.
-
-
royalaid about 4 yearsThis also works for most things with conflicts like reverts that result in needing a merge.
-
Philipp over 2 yearsThis wasn't in the Git Branches for me, but in the Git menu.