325

Subversion, Git, Mercurial and others support three-way merges (combining mine, theirs, and the "base" revision) and support graphical tools to resolve conflicts.

What tool do you use? Windows, Mac OS X, Linux, free or commercial, you name it.

Here's a few that I've used or heard of, just to get the conversation started:

(I recognize that this is sort of like the Best Diff Tool, but it's different in that I explicitly focus on three-way merge tools; WinMerge is off the list, for example.)

Carl Reinke
  • 345
  • 2
  • 12
Dan Fabulich
  • 37,506
  • 41
  • 139
  • 175
  • 2
    http://en.wikipedia.org/wiki/Comparison_of_file_comparison_tools – yoyo Feb 01 '13 at 18:01
  • See also [3-way XML merge algorithm](http://stackoverflow.com/questions/2222548) where I ask about 3-way merge of XML or HTML files. – ChrisW Feb 22 '10 at 16:51
  • 6
    Actually [WinMerge](http://winmerge.org/) does have 3 way comparison using it with VCS tools, you just need to pass 3 files ( left, right, result ) as arguments to the command line and it does the job. – Zilvinas Feb 11 '14 at 20:26
  • 5
    It's difficult to say what is the best merge tool, because it depends on subjective factors. But if you are looking a feature that marks the difference, try http://www.semanticmerge.com – Daniel Peñalba Mar 11 '14 at 18:26
  • I would like to add that you can also get BeyondCompare 3 Pro for Linux (not just windows). I hope that they release an OS X version in the future. – cseaton Feb 25 '09 at 23:53
  • 1
    @Zilvinas No, Winmerge does not support 3-way merge: it doesn't have an ancestor pane. – Johan Boulé Nov 25 '14 at 03:20
  • 2
    @yoyo I heard you like comparison, so I made a comparison of your comparison tools... – Neil Jul 26 '15 at 14:45
  • CodeCompare (https://www.devart.com/codecompare/) is also promising – koppor Sep 23 '15 at 13:18
  • 64
    How can this question be closed as not constructive? It has 182 upvotes, 123 stars and 11 answers, obviously many people think it _is_ constructive. – HelloGoodbye Apr 03 '16 at 20:44
  • 2
    @HelloGoodbye You do know what site you were on when you posted that comment right? ;) At least they don't outright delete useful questions like these... – chili Oct 19 '16 at 02:17
  • 3
    @HelloGoodbye StackOverflow's policy is to close opinion-based questions. – Shuklaswag Feb 09 '17 at 15:58
  • 3
    @Shuklaswag How does that relate to my question? I wondered why it was closed as "not constructive". – HelloGoodbye Feb 12 '17 at 14:13
  • 4
    @HelloGoodbye This is a constructive question in its own way, but it is not constructive to building the StackOverflow Q&A knowledge base. Shuklaswag is exactly correct, but you aren't completely wrong either. Questions like these specifically should be migrated to [SoftwareRecs.SE], where it would both be constructive AND constructive to the purpose of the site. [There are already questions about this exact thing on the meta](https://meta.stackoverflow.com/questions/281754/constructive-non-constructive-questions) which is the appropriate place to raise these concerns, not in comments. – Poik Aug 02 '18 at 16:44
  • The copy of the link from the original post: https://web.archive.org/web/20111025085647/https://stackoverflow.com/questions/12625/best-diff-tool – john c. j. Jun 30 '19 at 07:17
  • @Dan Fabulich I suggest editing the post since WinMerge does have full-blown 3-way Merge now. – Henrik Dec 01 '20 at 14:01
  • @Henrik WinMerge doesn't have 3-way merge does it? Left-Right-Base for the merge, and a result? I think I have the latest version, and it doesn't seem to have 3-way merge. – Bennett McElwee May 27 '21 at 05:55
  • 1
    @BennettMcElwee I believe it does have 3-way merge, if I'm not completely misinformed. See this [screenshot](https://i.ibb.co/GvMNFn1/winmerge-3-files.png). As you can see, I have 3 files open and can move diffs from either one of those to any other of the three. Maybe I'm missing something? – Henrik Jun 02 '21 at 15:36
  • 1
    @Henrik Actually you're right. I couldn't see it because I was accessing WinMerge through Git Extensions, and it seems to be configured to launch 2-way rather then 3-way. I might see if I can fix Git Extensions to launch 3-way merge. Although I have switched to P4Merge for now -- its 3-way merge integrated with Git straight out of the box, and I quite like its UI. – Bennett McElwee Jun 03 '21 at 00:08
  • @BennettMcElwee Nice. I couldn't figure out if P4Merge is paid or free. If paid, what's the price of it? Also, is there a portable version available? – Henrik Jun 04 '21 at 01:57
  • @Henrik It is [free and open source](http://ftp.perforce.com/perforce/r20.3/doc/user/p4v_license.txt). The [release notes](https://www.perforce.com/perforce/doc.current/user/p4vmergenotes.txt) have information about platforms and versions. – Bennett McElwee Jun 04 '21 at 05:35

13 Answers13

184

KDiff3 open source, cross platform

Same interface for Linux and Windows, very smart algorithm for solving conflicts, regular expressions for automatically solving conflicts, integrate with ClearCase, SVN, Git, MS Visual Studio, editable merged file, compare directories

Its keyboard-navigation is great: ctrl-arrows to navigate the diffs, ctrl-1, 2, 3 to do the merging.

Also, see https://stackoverflow.com/a/2434482/42473

enter image description here

Tigerware
  • 3,196
  • 2
  • 23
  • 39
sotto
  • 2,044
  • 4
  • 18
  • 22
  • 11
    More advantages of KDiff3: same interface for Linux and Windows, very smart algorithm for solving conflicts, regular expressions for automatically solving conflicts, integrate with ClearCase, SVN and Git, editable merged file, compare directories. – neves Jan 03 '13 at 13:05
  • integrates with visual studio too (it's possible to replace the default diff/merge tool, see http://blogs.msdn.com/b/jmanning/archive/2006/02/20/diff-merge-configuration-in-team-foundation-common-command-and-argument-values.aspx ) – sotto Jan 04 '13 at 12:46
  • Does Kdiff3 have the functionality to one the list of conflicted files to navigate through them (like in any IDE, for example Idea)? I'm using Kdiff3 for resolving the Git conflicts and it's open the files one by one, but it's quite inconvenient. – erkfel Aug 23 '13 at 19:04
  • 3
    @ThomasS That is not true, see the [other `kdiff3` answer](http://stackoverflow.com/a/2434482/42473) for an example. `kdiff3` will happily diff and merge whole directory trees and has done for many years! Some tools (such as `git`) may only launch it per file, but other tools (such as mercurial) will happily allow you to three-way diff/merge whole repositories. – Mark Booth Aug 18 '14 at 16:44
  • KDiff3 version 0.9.95 has a bug that improperly loads some UTF-8 text, not sure when/why. KDiff3 version 0.9.98 doesn't exhibit that, but has another bug that improperly loads Unicode files that contain byte value 13 (0D) because it replaces them with 10 (0A) believing them to represent carriage returns. Looking for another free merge utility to use until something newer than KDiff3 0.9.98 is available. – BlueMonkMN Jan 14 '15 at 18:33
  • 3
    KDiff3 is terrible when the local and other changes differ in the number of added lines; if locally you add lines A, B and C, but the other change only added A and C, then KDiff3 works out that A was added, then finds B conflicts with C, then adds C anyway. – Neil Jul 26 '15 at 14:51
  • Also KDiff crap is asking for sudo on Mac OS. – Nakilon Dec 21 '15 at 10:59
  • 4
    Does anyone have an opinion on this answer in 2016? – Shadoninja Apr 10 '16 at 18:27
  • 1
    I have just tried both kdiff3 and p4merge for automatically resolving git conflicts. kdiff3 has the --auto feature which is invaluable for scripting. I found that p4merge's algorithm is significantly more likely to resolve a conflict without requiring manual intervention. – user1976 Apr 19 '17 at 10:27
  • 6
    It doesn't supported since 2014 – Ruslan K. Jul 19 '17 at 08:01
  • 1
    In terms of diff functionality, it is pretty good and it provides a good overview of diffs. It often fixes simple merge conflicts for you too. That said, I really dislike using it. The text editor is painful. It doesn't allow basic operations like CTRL+Z or highlighting using shift+arrow keys. After all this time, I feel like I have no idea how this tool works because I keep having small and annoying issues with it, like its unwillingness to save or recognize that the merge conflict is saved. – Burak Sep 26 '18 at 14:31
  • 2
    @Shadoninja, I still a faithfully user of KDiff3 in 2020. I never found a feature good enough to make me change. – neves Feb 17 '20 at 17:32
  • 2
    One thing bad is that development of Kdiff3 seems to have stopped since 2014. Meld is still actively being developed in 2020. – guagay_wk Mar 02 '20 at 06:12
  • 1
    I find meld more intuitive and easier, at least when you need to make manual adjustments. Specially if you will modify more than one file. – Elizandro - SparcBR Mar 14 '20 at 22:27
  • 3
    @RuslanK. It seems still supported: https://github.com/KDE/kdiff3/graphs/commit-activity – Alex Pacini Jul 03 '20 at 14:15
  • 2
    Newer versions can be downloaded at [KDE.org](https://download.kde.org/stable/kdiff3/) – schoetbi Sep 30 '20 at 07:03
  • Although I like kdiff3, it is sometimes a bit stupid in detecting the correct corresponding block. Surely there must be a smarter tool. – Tigerware Jul 22 '21 at 09:10
  • I'm gonna check out the new version now. Sadly, I was still stuck on 0.9.8. I hope it got smarter since then. – Tigerware Jul 22 '21 at 09:27
  • What tool would you choose in 2021? – Tigerware Jul 22 '21 at 09:45
111

Just checked out P4merge since I heard about it in another blog article:

enter image description here

Very slick interface, and FREE! I've been a faithful Araxis Merge user, but considering this is free and awesome, I'd encourage you to check it out.

JGC
  • 5,725
  • 1
  • 32
  • 30
Dan Esparza
  • 28,047
  • 29
  • 99
  • 127
  • 11
    It's available for Windows, Mac, Linux, FreeBSD, and Solaris 10 – Grant Limberg Aug 15 '09 at 06:48
  • 1
    Good call, and it's one of the reasons I pay for and use Araxis Merge. – Dan Esparza Apr 07 '11 at 01:13
  • 36
    @Art: of course you can edit the merge result in P4Merge. I do it all the time! – Sklivvz May 16 '11 at 21:16
  • 1
    This is simply the perfect merge tool, and it's free. For those using Visual Studio, it integrates perfectly (http://www.richard-banks.org/2009/09/using-p4merge-with-visual-studio-2008.html) – Clafou Jan 16 '12 at 14:42
  • I find it is missing alot of editing functionality. And for files just around 250+ kb it is slow. (i7 quad SSD laptop) :( – Moulde Feb 29 '12 at 14:02
  • p4merge is no longer available for linux? Can't find it [here](http://www.perforce.com/downloads/complete_list#ntx86). – Hindol Jul 23 '12 at 03:56
  • 12
    p4merge is also not "free" for enterprise. The license is limited for commercial use. – DH4 Jan 16 '13 at 17:49
  • 2
    git integration: git config --global merge.tool p4merge; git config --global mergetool.p4merge.cmd "p4merge $BASE $LOCAL $REMOTE $MERGED". (Assuming p4merge.exe is in your path. Add -dw option to ignore whitespace.) – yoyo Feb 01 '13 at 17:17
  • It's like the more graphical version of kdiff3! Why do some prefer kdiff3? – sabgenton Apr 29 '13 at 15:25
  • 27
    @DH4 I just received an E-Mail from official Perforce support and P4Merge is **free for commercial use** (I work for MS, it doesn't get more enterprise than that ;)) – Ohad Schneider Aug 03 '14 at 09:09
  • 1
    Old post but kdiff3 has a feature advantage; mine and theirs lines can be chosen in either order. Haven't really tested if you get more info from P4M's pretty-er line comparisons, but they do read nice. – sabgenton Dec 01 '14 at 21:02
  • 4
    No folder comparison support in P4merge. It would have been a really great addition to P4Merge. – RuntimeException May 05 '16 at 08:35
  • 1
    kdiff3 is open source and Free Software, while P4Merge is not. – Colin D Bennett Nov 02 '16 at 19:21
  • I would like to try kdiff3 but I have been unable to install without admin rights on MS Windows... – espinielli May 12 '17 at 08:47
  • 1
    I couldn't figure out how to split conflicts into line-by-line comparisons, and there doesn't seem to be keyboard shortcuts to resolve conflicts in P4merge. Hence, it only looks good, but is severely lacking in functionality for my purposes. – CodeManX Aug 21 '17 at 10:28
  • 2
    Apparently P4merge is now called "Helix Visual Merge Tool". In this link it's called "Helix P4Merge and Diff Tool" but when you go to download it's the other name: https://www.perforce.com/products/helix-core-apps/merge-diff-tool-p4merge – Andrew Jan 23 '18 at 00:01
  • 1
    P4Merge can also be installed with Chocolatey (`choco install p4merge`) – cowlinator Jun 14 '19 at 19:56
  • How does it compare to kdiff3 in 2021? Either of them smarter in auto solving conflicts? – Tigerware Jul 22 '21 at 09:53
104

Beyond Compare 3 Pro supports three-way merging, and it is a pretty impressive merge tool. It's commercial (but worth it, IMHO) and is available on Windows, Linux, and Mac OS X.

As pointed out in a comment, it's also inexpensive.

Enter image description here

Note: If one does not have a merge set, that is, merge markers resident in the destination file, Beyond Compare does not offer three-way file compare/editing. Beyond Compare says that feature is on their list.

Note: 3-way merge is a feature in the Pro edition of Beyond Compare 3 only

Brian
  • 14,610
  • 7
  • 35
  • 43
Joshua McKinnon
  • 24,489
  • 11
  • 57
  • 63
83

Meld Diff Viewer

I have had only good experiences working with Meld. I use it when I have to do messy code merges between branches. It is simple to use and has a clean interface.

  • Open Source
  • Linux, Windows and MacOS Supported
  • Multiple File Diff
  • Three-way Compare Support

In Ubuntu, install is as simple as: sudo apt-get install meld

enter image description here

Jonathan Mee
  • 37,899
  • 23
  • 129
  • 288
Elijah
  • 13,368
  • 10
  • 57
  • 89
  • 4
    +1 Meld is slick, clean, "just enough" software. – Trevor Bramble Feb 23 '09 at 20:57
  • Just gave meld a spin to diff/merge two branches, was almost perfect except for a SVN created false WS – David Jan 12 '11 at 17:25
  • 1
    @aib could you please elaborate? In what way is it flawed/misleading? I just did hg merge --tool=meld and I found it quite satisfactory. – Aryeh Leib Taurog Apr 19 '12 at 18:22
  • @Aryeh Leib Taurog: I don't remember. I think it was something like text missing in A (as compared to B) showing up in A (as "missing") instead of in B (as "extra"). You may very well have found your one-time experience satisfactory; I have done the same at one time or another with all the available merge tools in Ubuntu. But one does not appreciate a really good merge tool until one tries to do a 3-way merge for their coworkers, on a codebase one knows nothing about. *Then* it becomes crucial whether you can tell what belongs where at a glance. – aib Apr 20 '12 at 16:14
  • 74
    Meld, unfortunately, is *NOT* three-way merge tool (even they state it on the homepage). For three-way merging you need _FOUR_ windows (the base file). But I love meld, works great. – lzap Jun 15 '12 at 09:31
  • Meld doesn't run out of the box in Windows. More info here https://live.gnome.org/Meld/Windows – yoyo Feb 01 '13 at 17:13
  • 11
    @lzap, actually meld *was* three-way, but it was undocumented and a month or so ago I noticed they've completely removed the 3-way merge: http://is.gd/prKX5d If you stick with an old enough version you are still in luck though. – Magnus Apr 22 '13 at 06:36
  • Interesting... thats unfortunate :-( – lzap Apr 22 '13 at 09:31
  • Fantastic app. This is also the only light weight graphical three way compare tool I have found that does force you into merge mode. Exactly what I was looking for with my present upgrade project. I'm moving away from UltraCompare to Meld effective immediately :) – Timothy C. Quinn May 23 '13 at 19:58
  • Meld now runs out of the box on Windows. It looks great, however it's diff tool isn't as smart as BeyondCompare, KDiff3, and DiffMerge. – leetNightshade Apr 03 '14 at 23:02
  • @yoyo: `Meld doesn't run out of the box in Windows.` Meld 3 now runs on Cygwin. – kevinarpe Dec 30 '14 at 02:08
  • Just tried it in Windows. It runs out of the box but has numerous UI flaws (opening context windows in the wrong place of the screen, cumbersome file/directory chooser, etc.) – Jason S Jul 01 '15 at 20:28
  • I have experience with Kaleidoscope, Meld, KDiff3, vim difftool and a handful of others. Honestly, at least at the moment, on the Mac, I find Meld is perfect. Sure, it's not the fanciest of applications, but it does an excellent job. – Matthew Setter Apr 18 '18 at 10:00
  • 5
    As of today, Meld supports 3way diff reliably for quite a while, and also runs out-of-the-box on Windows for quite a while (other than indicated in earlier comments). The glitches that were described in comments are (hopefully, at least in my experience) a thing of the past as well. – ypnos Jan 16 '20 at 11:25
57

vimdiff. It's great. All you need is a window three feet wide.

enter image description here

Ciro Santilli OurBigBook.com
  • 347,512
  • 102
  • 1,199
  • 985
Paul Beckingham
  • 14,495
  • 5
  • 33
  • 67
  • 12
    Took some time to figure out that you can do "gvimdiff -O branch1.txt base.txt branch2.txt merge.txt" and the use ctrl+w J to move the merge buffer to the bottom of the screen. Is this how you use it? – Wim Coenen Feb 21 '09 at 14:39
  • 1
    Pretty much, except I use vim, not gvim. – Paul Beckingham Feb 21 '09 at 15:52
  • 8
    downvote, it doesn't really resolve conflicts, it's just diff. – piotr Feb 14 '12 at 20:02
  • 3
    vimdiff now has nice git handling for 3-way merging (ie 4 panes) - http://vim.wikia.com/wiki/A_better_Vimdiff_Git_mergetool#Vimdiff_for_three-way_merges – Sonia Hamilton Aug 28 '12 at 02:43
  • 13
    @piotr vimdiff does indeed resolve conflicts. You use the command "diffg " to build the merged file in the bottom pane. The buttom merge pane is buffer 1 the others are 2,3,4 across the top. To jump to diffs use [c and ]c. This is out of the box functionality on debian wheezy 7.7. – ikky Jan 08 '15 at 01:33
  • 3 feet wide? They don't sell screens in that size over here. – Tigerware Jul 22 '21 at 09:30
37

Source Gear Diff Merge:

Cross-platform, true three-way merges and it's completely free for commercial or personal usage.

enter image description here

Dan Esparza
  • 28,047
  • 29
  • 99
  • 127
Christian C. Salvadó
  • 807,428
  • 183
  • 922
  • 838
  • diffmerge is quite nice, though it takes a while to start up. – frankster Aug 04 '09 at 14:02
  • 1
    I've used DiffMerge for years and liked it. However, I read [this](http://www.geekgumbo.com/2010/05/11/perforces-p4merge-file-comparison-editor-a-review/) blog post where the author was looking at diff-merge tools and whittled down the list to DiffMerge and P4Merge. He ended up going with P4Merge simply because it had a nicer interface. I've just started using P4Merge today and I would have to agree. In particular, DiffMerge does not show changes well - it shows them as a deletion and insertion. This can be confusing if there are many changes close together. P4Merge displays it better. – Simon Elms May 18 '12 at 07:35
  • 1
    I see that diffmerge is [not free](https://www.sourcegear.com/diffmerge/register), it costs $19 – erkfel Aug 21 '13 at 19:19
  • 3
    @erkfel, That is incorrect. Registration is optional and the software is free to use: "SourceGear DiffMerge is an award-winning file diff and merge tool that has been helping professional developers and hobbyists since 2007. SourceGear DiffMerge is licensed for use free of charge. However, by registering DiffMerge you will help fund new product development, maintenance, and support. As a way of thanking our registered users and encouraging additional registrations, we have added some new features in 4.2..." (in program text) – Muhd Jan 10 '14 at 20:07
  • @SimonTewsi Things to have reversed. P4Merge displays moved lines as a deletion and insertion, whereas DiffMerge properly shows it as being moved. So as of right now from my testing, DiffMerge is actually better than P4Merge. – leetNightshade Apr 03 '14 at 22:57
  • 1
    One thing I find useful in DiffMerge, compared to P4Merge (which I now use for diffing and merging in git), is that it integrates with Windows File Explorer. In particular, I can remember a file in one folder, then compare the remembered file to another in a different folder. I find this useful maybe once or twice a month, where I don't have to move two files into the same folder to compare them (eg SQL scripts not under source control). – Simon Elms Feb 12 '15 at 00:57
  • 1
    @SimonTewsi: P4Merge for Mac does not require that files be in the same folder. It allows you to browse the file system and select base, first, and second files from anywhere on the computer. – Steve Samuels Jan 16 '16 at 18:52
  • @SteveSamuels: Good to know, I'll see if it works with P4Merge for Windows as well. Thanks. – Simon Elms Jan 16 '16 at 23:08
  • 2
    No longer being developed/updated since 2013. – wisbucky Feb 27 '18 at 23:09
34

Kdiff3 conflict resolution algorithm is really impressive and it nicely integrates with Git.

I recommend to configure it as Git mergetool or to use a nice Git frontend as GitExtensions.

Even when Git/Subversion indicates a conflict, Kdiff3 solves it automatically. There's versions for Windows and Linux with the same interface. It is possible to integrate it with Tortoise and with your linux shell. Side note: you can also experiment with Git merge strategies

It is in my list of favorite open source software. One of the first tools I install in any machine.

You can configure it as the default diff tool in Subversion, Git, Mercurial, and ClearCase. It also solves almost all the ClearCase conflicts. In Windows, it has a nice integration with windows explorer: select two files and right click to compare them, or right click to 'save to later' a file, and then select another one to compare.

The merged file is editable, so you can fine tune after merge conflicts. Has slick keyboard shortcuts.

You can also use it compare and merge directories. See: Kdiff3 Comparing directories

An advanced feature is to use regular expressions for defining automatic merges.

My only annoyance is that it is a little difficult to compile if it isn't present in your favorite distro repository.

neves
  • 33,186
  • 27
  • 159
  • 192
  • 3
    I agree about the merge algorithm. It is incredible sophisticated, and strangely seems to "know" what you want to do in a way that other tools cannot. It regularly crushes diff3 and Subversion (blarg), and can even be helpful with a Git merge. – kevinarpe Dec 30 '14 at 02:10
  • where are the keyboard shortcuts to goto next and choose a/b/c? – mylord Mar 29 '15 at 13:57
  • @mylord : use a small Auto-Advance-delay and the shortcuts Ctrl-1/2/3 to select A/B/C for many conflicts. – neves Apr 07 '15 at 18:03
  • has anything replaced KDiff3 for you? Big user of it, but I find myself seeing if there is a better alternative these days – chrispepper1989 Feb 17 '20 at 11:04
  • 2
    @chrispepper1989, I still use KDiff3 in Git today. I've never found a 3 way merge app that's significantly better than KDiff3. P4Merge has a more modern interface, but when I tested it you couldn't edit the merged file (I think you can do it now). – neves Feb 17 '20 at 17:26
  • Thanks :) I found out that kdiff was being slow due to a weird quirk from a new security tool we have now, so I'm happily back to using kdiff :) sometimes I use meld to see the directory impact – chrispepper1989 Feb 18 '20 at 13:59
  • @neves: P4Merge allows editing the merged file. – Simon Elms Dec 14 '22 at 02:14
33

Araxis Merge. It is commerical, but it is so worth it... It is available for Windows and the Mac OS X.

Enter image description here

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Dave
  • 691
  • 4
  • 6
  • 5
    Agree, it's the best I've used. – Dan Olson Feb 25 '09 at 01:58
  • 1
    My observation: Its relatively slow when handling large files around 5MB. – Naga Kiran Dec 27 '09 at 17:14
  • 4
    +1 for Araxis. One of the few tools I was willing to pay good money to have for personal use. Everything else is cluttered, confusing, and pales in comparison (pun intended). – Dan Esparza Aug 08 '11 at 21:44
  • 9
    After using Araxis for a long time my company has switched to KDiff3 for the following reasons: (1) When a merge in Araxis is cancelled the file still gets marked as resolved in TortoiseHg. (2) Araxis shows a mixture of the base revision & the merge result in the "Merge Result" pane which is frequently confusing. (3) From TortoiseHg KDiff3 will automatically merge without user interaction if it can do so. (4) KDiff3's merge algorithm just seems to do a better job. However we still use Araxis as our compare tool :) – Michael Platings Jul 20 '12 at 16:02
  • 2
    As mentioned in the comments for other answers, a proper 3-way merge tool has 4 panels - base, local, remote and _result_. Araxis conflates base and result, which can lead to problems. – neonblitzer Jan 17 '20 at 08:52
17

I love Ediff. It comes built-in with GNU Emacs.

To do a three-way diff, use ediff-files3 (for selecting three files) or ediff-buffer3 (for selecting three already-open buffers). You'll get a screen looking like this:

three-way diff in emacs

Note the word-difference higlighting.

You can hit n or p to go to the next/previous diffs, while ab will copy the region from buffer a (the leftmost one) to buffer b (the middle one), and similarly for other two-letter combinations of a, b, c; rb will restore the region in buffer b. Hit ? for a quick help menu, or read the fine manual on diff3 merging in Emacs.

unhammer
  • 4,306
  • 2
  • 39
  • 52
jcrossley3
  • 11,576
  • 4
  • 31
  • 32
  • 8
    As much as I love ediff, I see only two buffers above... a 3-way merge is supposed to have 3 or 4 windows: the three being merged (local, remote and their common ancestor base), and the final merge output. There *does* seem to be a 3-way merge in ediff (called `ediff-merge-with-ancestor`) but I'm not sure if it has 3 panes or 4, and also the screenshot above doesn't reflect that. – ShreevatsaR Mar 05 '13 at 05:24
  • Edited to show a three-way diff @ShreevatsaR – unhammer Apr 26 '19 at 06:52
  • @unhammer Thanks this is better, but it still only shows 3 windows so it's not clear that it's a true 3-way diff (which would have 4 windows; see the kdiff3 and other examples). If what's shown in the screenshot are the three things being merged, where is the output? – ShreevatsaR Apr 26 '19 at 07:07
  • You destructively modify one (or more!) of the buffers. That's why I mentioned that `ab` will copy the region from buffer a to buffer b. I don't think there's a four-window version of `ediff` yet. (I know `emerge` uses a dedicated output buffer instead, but `emerge-files-with-ancestor` doesn't *show* the ancestor, only [uses it to guess the correct version](https://www.gnu.org/software/emacs/manual/html_node/emacs/Overview-of-Emerge.html#Overview-of-Emerge) by seeing which one agrees with the ancestor.) – unhammer Apr 26 '19 at 07:16
13

Ultracompare. It is really good, handles large files (more than 1 GB) well, is available for Windows/Mac/Linux, and it's commercial, but it is worth it.

Screen shot of UltraCompare Professional on Windows

Mofi
  • 46,139
  • 17
  • 80
  • 143
MrTelly
  • 14,657
  • 1
  • 48
  • 81
  • I don't know how to set it to support 3-way merging... Can it display a base file in the middle, 2 changed files at left and right, so I can see what are changed in both files based on the base file and have the merged result of 2 changed files in at bottom? I'm using UltraCompare 17.0 – Ricky Jan 17 '18 at 13:59
  • 1
    A bit of googling found this https://www.ultraedit.com/support/tutorials-power-tips/ultracompare/block-line-mode-merge.html - talks about 3 way merging in the step 6 advanced merge. – MrTelly Jan 17 '18 at 22:32
12

Diffuse is an easy to use three-way merge tool. It supports all of the platforms and version control systems you mentioned, and it can compare more than three files at the same time.

enter image description here

Jordan Ryan Moore
  • 6,877
  • 2
  • 26
  • 27
6

xxdiff if you're in Linux land.

Enter image description here

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Mark Harrison
  • 297,451
  • 125
  • 333
  • 465
4

The summary is that I found ECMerge to be a great, though commercial product. http://www.elliecomputing.com/products/merge_overview.asp

enter image description here

I also agree with MrTelly that Ultracompare is very good. One nice feature is that it will compare RTF and Word docs, which is handy when you end up programming in word with the sales guys and they don't manage their docs correctly.

Steve Midgley
  • 2,226
  • 2
  • 18
  • 20