Merge provides a number of tools to enable you to quickly merge text files together to produce a file that can be saved. This section describes the merging process in detail.
As well as the merging operations described below, you can always fine-tune by editing text in-place. For more information, see Editing Files.
Merging buttons, menu items, and keyboard shortcuts
There is a small merging button at the top-right corner of each block of changed lines.
Click on the merging button to make the lines replace the corresponding block of lines in the other file. To insert the block of lines after the lines in the other file, hold down the Cmd key when you click. Similarly, you can insert the block of lines before the lines in the other file by holding down the Option key when you click. To delete a block of lines, hold down Cmd+Option and click on the button. The icon displayed on the button will change when you press the Cmd , Option , or Cmd+Option keys.
When using merging buttons to copy lines from one file to another, or when inserting text into a file in any other way, Merge changes the line endings (CR and/or LF characters) in the lines copied to the predominant line endings found in the destination file. If this is not the behaviour you desire, you can specify different line endings when you save a file, as described in the topic Saving Files.
In addition to the merging buttons, you can use the items on the Merging▸Current Change menu to replace, insert and delete blocks of change lines. The following keyboard shortcuts are also defined:
|Option+Cmd+→||Pull the corresponding change from the left to replace the current change.|
|Shift+Option+Cmd+→||Pull the corresponding change from the left to replace the current change and move to the next change.|
|Option+Cmd+←||Pull the corresponding change from the right to replace the current change.|
|Shift+Option+Cmd+←||Pull the corresponding change from the right to replace the current change and move to the next change.|
|Ctrl+Shift+←||Push the current change to the left to replace the corresponding change there.|
|Ctrl+Shift+→||Push the current change to the right to replace the corresponding change there.|
|Ctrl+Option+←||Push the current change to the left and prepend it to the corresponding change there.|
|Ctrl+Option+→||Push the current change to the right and prepend it to the corresponding change there.|
|Ctrl+Cmd+←||Push the current change to the left and append it to the corresponding change there.|
|Ctrl+Cmd+→||Push the current change to the right and append it to the corresponding change there.|
In each case, the keyboard-shortcut arrow indicates the direction in which the change moves.
For a full list of keyboard shortcuts, see Keyboard Shortcuts.
The merging buttons and the commands in their context menus may not provide the exact merge result that you desire. Use drag and drop text editing or the Copy and Paste commands to copy just part of a block of changed lines or to insert lines at an arbitrary location in another file.
Change blocks can be broken into individual lines using the Break change blocks into individual lines option on the Display preference page.
When merging changes from one file into another, you may need to correct the indentation of the merged changes. Highlight the lines you want to adjust and press Option+] or Option+[ keys to indent or un-indent the block of highlighted lines.
Marking of changes
Every change that is made to a file is flagged with an edit marker . If lines are introduced into a file, then a small arrow next to the edit marker ( or ) indicates the file from which the lines were copied. If lines are removed from the file, then a delete marker is placed on the line after the position at which the lines were removed.
Each edit marker has an associated tool tip that explains why the edit was made. Hold the mouse cursor over the marker for a few seconds to see the tool tip. Conflict markers also have tool tips to explain the reason for the conflict.
You can navigate between edit markers using the Next Edit and Previous Edit toolbar buttons. You can also select the Edit▸Markers▸Next Edit and Edit▸Markers▸Previous Edit menu items, or press F3 or Shift+F3.
Replacing the contents of one file with another
If you want to replace one file with the contents of another file, you can use the Replace Content toolbar button.
Merge also supports automatic merging of two modified files into a common ancestor file. For more information about this type of merging, please see the Three-Way File Comparisons and Automatic File Merging topics.