Saturday, August 6, 2011

Edit conflicts in eclipse using submerge

Everyone using Eclipse + SVN (or other non-locking version control system) has gone through the hell of editing conflicts with default Eclipse tool. I don't know, maybe there are people liking this, but for me is very unhandy, messy and produces more work than doing the merge without any tool. I just cannot see what is currently merged, how it's done and what is to be done already in this editor window:


Furthermore every important thing needs here to be done by manual copy & paste from right to left.

I remember when once (and enoughs ;) ) I worked in company using Windows, where I was using TortoiseSVN integrated with Windows Explorer. The comfort between their "edit conflict" tool and this one just cannot be compared.

For longer time I was looking for alternatives in Linux. I passed through all known tools like kdiff3 or meld but in my opinion they are great for diff, but not for edit conflicts. However recently I've finally found appropriate editor and I'm very satisfied from using it. This is a submerge tool from subcommander.

In "edit conflicts" mode it provides three panels with "mine" and "theirs" version (at the top) and initial merge result (at the bottom). It's very convenient for usage - you can navigate change by change using buttons on toolbar. By default always the blue change is applied into a merged file. If you like to change this you just double click on the version you want to apply in "mine" or "their" file. All conflicting changes are highlighted with red color, and you can choose appropriate change also with double click. The exemplary conflict edition looks following:


To install submerge just download and install latests subcommander from the website or from your package repository (it's available in Debian / Ubuntu repositories as subcommander). After installation you should have submerge command available from command line.

Last thing is to integrate submerge into Eclipse. This can be done using Windows | Preferences | Team | SVN | Diff Viewer. Add here new file association for all files ('*'):


The arguments for both commands to copy&paste are following:
  • diff ${base} ${mine}
  • merge ${base} ${mine} ${theirs} ${merged}
You can then enjoy with submerge in "Compare with..." and "Edit conflicts" functions.

1 comment:

  1. Thanks so much for this article - so helpful! I have been looking a long time for a good tool for resolving conflicts on linux.

    ReplyDelete