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?
Asked
Active
Viewed 5.2k times
26
-
1Choose your case [from here](https://www.jetbrains.com/help/idea/undo-changes.html). – harrymc Jan 18 '18 at 08:58
2 Answers
32
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"...
Olivier Gérardin
- 420
- 4
- 6
-
1This also works for most things with conflicts like reverts that result in needing a merge. – royalaid Feb 25 '20 at 05:43
-
21
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.
Noam Manos
- 1,804
- 1
- 20
- 20
