How do you do a 3-way merge in FileMerge?
Asked Answered
C

4

6

I see the option for specifying three files (left, right, and ancestor), but it doesn't seem to be possible to actually display the ancestor.

enter image description here

The bottom pane shows the result of the merge. I'd rather see what the original content was, so I could understand the context for the left and right sides of the conflict. Is this possible? FileMerge has awful help documentation.

Cuccuckold answered 22/7, 2010 at 18:53 Comment(0)
N
4

To my knowledge, this is not possible with filemerge.

Paid (but very good) app: http://www.deltopia.com/

Open source: http://sourcegear.com/diffmerge/

Nitro answered 1/3, 2011 at 9:26 Comment(2)
Perforce's P4Merge is a free and wonderful 3-way diff/merge tool and is available for OSX, Linux and WindowsAtone
Since this is the accepted answer and people are plugging their fav tools, I will just mention kdiff3 (also mentioned in answer below), which is free and does 3-way merges very well. It is fairly ugly (on OSX) but keyboard friendly and easy to use.Spinelli
C
5

Looks like in version 2.5 they have finally added this feature. "Ancestor" now actually means "Ancestor" and there is a separate "merge" option

From the command line you can do something like this:

$ opendiff mine theirs --ancestor base

Where "mine" is my version of the file, "theirs" is the version I'm trying to merge with, and "base" is the common ancestor of "mine" and "theirs.

This command will open File Merge and show the ancestor at the bottom (where the merge is in my example from 2010).

Unfortunately, it's not possible to use the --merge option along with the --ancestor option. So you can't view a three-way merge AND use File Merge to resolve the conflicts at the same time.

I am starting to use File Merge for viewing and understanding the conflict, then editing the conflict markers in a text editor as usual. (sigh...)

Cuccuckold answered 18/8, 2011 at 15:41 Comment(1)
I use FileMerge 2.5...the option Ancestor is there but at the bottom doesn't appear the ancestor file...There is only the merge product. Any idea?Brigittebriley
N
4

To my knowledge, this is not possible with filemerge.

Paid (but very good) app: http://www.deltopia.com/

Open source: http://sourcegear.com/diffmerge/

Nitro answered 1/3, 2011 at 9:26 Comment(2)
Perforce's P4Merge is a free and wonderful 3-way diff/merge tool and is available for OSX, Linux and WindowsAtone
Since this is the accepted answer and people are plugging their fav tools, I will just mention kdiff3 (also mentioned in answer below), which is free and does 3-way merges very well. It is fairly ugly (on OSX) but keyboard friendly and easy to use.Spinelli
W
4

@mehaase: That is not exactly correct. Here is the documentation on the new ancestor option from FileMerge Help:

Sometimes, you need to compare two versions of a file that have been modified
independently. For example, say two people branch a file; that is, they make
copies of a file and modify it. In this case, specify an ancestor file, which
is the common ancestor of the modified files.

The ancestor file lets FileMerge choose when to take changes from the left
file or the right file. For example, say the left file and the right file
contain a different version of line 33. If line 33 in the ancestor matches
line 33 in the left file, you know the change happened after the two files
branched off, and FileMerge prefers the newer version of line 33 in the right
file. If line 33 is different among the three files, you know that the files’
editors edited the lines separately. FileMerge displays that difference with
a red border and asks you to choose with edit to use.

So the ancestor is still not displayed, but it helps the merge tool to make a little more informed decisions when it decides to choose the left or right sides by default.

Wharve answered 7/4, 2012 at 8:50 Comment(2)
Wow, excellent point. I don't know what I was thinking when I posted my answer. I just tried it in version 2.7 and you're right, the bottom shows the merge result, not the ancestor! FileMerge continues to be useless for programmers. I wonder what Apple's own developers are using.Cuccuckold
@MarkE.Haase I know this is really old, but for 2-way diffs and merges, FileMerge is the best tool around for its minimal interface setup for speed. It has only 6 keys: Up (prev diff), Down (next diff), Left (use left), Right(use right), Cmd-S (save), and Escape (quit). It starts quickly and those keys make it super fast to process a diff/merge. It can't do 3-way, but you just use a different tool for that. When I'm not on MacOS, I genuinely miss FileMerge.Travax
F
2

I realise this answer technically doesn't answer the question on how to do it with FileMerge, but I use kdiff3 (available for Windows, Mac and *nix) and it shows the base/ancestor, plus left and right, plus output/result, for a 3-way merge. (http://kdiff3.sourceforge.net/)

It's not a pretty user interface, but (IMHO) it's fairly simple to use and works well. And it's open source. :-)

Felecia answered 31/10, 2013 at 6:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.