Home > Net >  How to "Mark Resolved" a conflict in IntelliJ when using git?
How to "Mark Resolved" a conflict in IntelliJ when using git?

Time:11-11

IntelliJ (2021.3.1 in this case) has an tool - via right-click, Git, Resolve Conflicts... - which provides a three-pane yours/merged/theirs tool to fix conflicts.

However, I always find it much easier to fix the problems in situ, in the normal IDE edit pane, then flag that the conflicts are fixed.

Having done this though, how do you flag that the problems with the file in question are fixed?

When using IJ in the past with Subversion there was an option to just flag the file as fixed (right-click, Subversion, Mark Resolved - I think it was.)

Surely there must be a way to do the same when using git?

This seems like a really simple thing. But I'm now on my third Google attempt, and trawl through the IJ documentation, and nothing.

UPDATE:

To be clear, I don't want to have to use the 3-pane Merge Revisions dialog at all. I want to edit the differences as shown in the regular edit window (as per below) and then flag the file as fixed when done. This used to be possible, at least with svn, though I suspect this might be a IJ version difference rather than specifically about svn vs git. The menu options to to Mark Resolved the current file just isn't there any more.

e.g. I want to edit this directly in the IDE ...

before
<<<<<<< HEAD
my changes
=======
their changes
>>>>>>> master
after

And when I've edited it to be...

before
my changes and their changes
after

... I just want to flag in IJ that I've fixed the conflict.

CodePudding user response:

Having done this though, how do you flag that the problems with the file in question are fixed?

If IntelliJ still prompts you to resolve merge for a file you already cleaned up (remove/resolve the merge markers), you can still select Resolve Conflict.

The IDE should show you, as https://www.jetbrains.com/idea/guide/static/9b8943eeb17d4566a785fd7c432729f4/fcda8/finish-merging.png

When you have successfully resolved all your merge conflicts, IntelliJ IDEA will prompt you that All Changes have been processed.
When you press Apply the conflicts in the file are all resolved.

CodePudding user response:

Just git add the file in question. Or use IntelliJ's Add to VCS action on the file.

enter image description here

  • Related