Abort conflicting merge in egit

functionpointer picture functionpointer · Sep 13, 2013 · Viewed 10.4k times · Source

I recently did a misclick in the repositories view and merged two commits that can't (and shouldn't) be merged. The result was a merge conflict.

Native git has git merge --abort for such cases.

However, i cant find such an option in egit.

Answer

VonC picture VonC · Sep 13, 2013

Check the section "Aborting a merge":

If a merge resulted in conflicts you can abort the merge with a hard reset to the current branch. This can be done in state "Conflicts" and in state "Merged", i.e. before and after you have resolved the conflicts.

The hard reset can be done from the team menu, the Git Repositories View or the History View. See Revert all local and staged changes for more details.

Revert all local and staged changes

This can be done as a special case of reset. If you reset to the current HEAD (normally the last commit on your branch) with the option hard you overwrite the working tree and the index with the content of the HEAD. You can do this in three ways:

  • Select Team > Reset... on a project. In the dialog select HEAD or your current branch and switch the radio button to hard.
  • Right click and select Reset... on any branch or tag in the Repositories view. This opens a dialog which lets you decide on the reset type. Choose hard here.
  • Open the context menu on the HEAD commit in the history view and select Hard Reset.

Make sure you didn't have any local modifications: there would be lost with a hard reset.