Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you do a 3-way merge in FileMerge?

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.

like image 943
Mark E. Haase Avatar asked Jul 22 '10 18:07

Mark E. Haase


3 Answers

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...)

like image 77
Mark E. Haase Avatar answered Oct 21 '22 10:10

Mark E. Haase


To my knowledge, this is not possible with filemerge.

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

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

like image 35
Philip Paetz Avatar answered Oct 21 '22 11:10

Philip Paetz


@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.

like image 4
Jake Griffin Avatar answered Oct 21 '22 11:10

Jake Griffin