Resolving SVN Conflicts with FileMerge.app on OS X

One of my frequent gripes when working with source code, is versioning conflicts, and particularly on OS X, the lack of free conflict resolution applications.

As most any developer on OS X knows, the Developer Tools provide an application called “FileMerge.app”, whilst from the name it seems obviously made for this task, its not *that* simple, first SVN leaves you with 4 files, and it’s not immediately obvious what each one is for.

The solution is simple however, with a little work, which I have done for you, you can easily merge changes.

When opening FileMerge, you are presented with a small dialog asking for “Left” and “Right” files, you will notice, that it also states in the bottom left: “Enlarge window to specify ancestor and/or merge paths.”, you should do this.

Next, you choose the following files, for the following spots, assuming a file called “source.php”:

Left: source.php.working
Right: source.php.merge-right.r#
Ancestor: source.php.merge-left.r#
Merge: source.php

FileMerge > OpenOnce you have all these specified, choose “Compare” and you will see in the bottom left, it now states the conflicts (in red), and that some arrows are sorta red in color (its not obvious).

FileMerge Conflict

By using the keyboard commands, Cmd+(Down Arrow) you can then start to navigate the differences. Any conflicts are outlined in red, in both left and right, and the merged copy. You can move directly to conflicts using Cmd+D.

FileMerge > OpenYou can then use Cmd+(Left Arrow) or Cmd+(Right Arrow) to choose the left or right side respectively, or alternatively, just edit the merged copy (be warned, if its more than one line this will break stuff). You can then just choose “File > Save Merge (Cmd+S)” and then use “svn resolved” to inform SVN you’re done. Finally, commit.

– Davey