Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to abort merging when conflicts occur in IntelliJ Idea

I use IntelliJ Idea with Git. When I pull from repository, I get Merge Conflict error. On the bottom right of IDEA shows merging feature/branch-XXX after the conflicts. Now I want to abort this pull(merge).

I could reset the current branch to clean status. I could also abort the merging with TortoiseGit.
But how can I abort the merging conveniently with IDEA?

like image 213
niaomingjian Avatar asked Sep 23 '18 05:09

niaomingjian


People also ask

How do you cancel merging if there are conflicts?

How do I cancel a git merge? Use git-reset or git merge --abort to cancel a merge that had conflicts. Please note that all the changes will be reset, and this operation cannot be reverted, so make sure to commit or git-stash all your changes before you start a merge.

How do I undo a merge in IntelliJ?

Revert uncommitted changes You can always undo the changes you've made locally before you commit them: In the Commit tool window Alt+0 , select one or more files that you want to revert, and select Rollback from the context menu, or press Ctrl+Alt+Z .


1 Answers

conveniently? Not yet (Sept. 2018), not before 2019.2 (see below)

This is what issue IDEA-119995 is for.

Git: provide possibility to abort merge process

Before 2019.2, you had to switch to the terminal and type git merge --abort.


The related issue IDEA-122038 adds in May 2019:

Cherry-pick now is recognized in the same way as rebase and merge, and indicated in the same way - Branch indicator in the status bar shows Cherry-picking in <branch>.

It is also possible to abort Cherry-pick in the same way - using Abort action in the Branches popup or VCS - Git menu

So the option to abort should be available since IntelliJ IDEA 2019.2.

https://youtrack.jetbrains.com/api/files/74-659081?sign=MTU3ODc4NzIwMDAwMHwxMS0xfDc0LTY1OTA4MXw0ZEJuMHBNZnNZRnkxWjc2WlRaZk5SNlJ2VVdjMFF5bGlDMWVmanQ5dHc0PQ==&updated=1557149118930

This is an image for cherry-pick, but it would apply to merge and rebase as well.

like image 151
VonC Avatar answered Nov 15 '22 10:11

VonC