English | 日本語
Home > Merge (Mac) > Documentation Contents > Merging Files

Merging Files

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.

In-place editing

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

There is a small merging push-button 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 Append merging button, Option Prepend merging button, or Cmd+Option Remove merging button 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.

You can also use keyboard shortcuts to replace, insert and delete blocks of lines:

For a full list of keyboard shortcuts, see Keyboard Shortcuts.

Fine-grained merging

The merging buttons and the commands in their context menus might not enable you to perform every type of merging. 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 in the File Comparisons > 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 unindent the block of highlighted lines.

Marking of changes

Every change that is made to a file is flagged with an edit marker Edit marker. If lines are introduced into a file, then a small arrow next to the edit marker (Left edit marker or Right edit marker) indicates the file from which the lines were copied. If lines are removed from the file, then a delete marker Delete edit 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 commands in the Markers section of the Edit menu.

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 commands located on the toolbar. Simply click the Copy From Right toolbar button or Copy From Left toolbar button button to replace the file to the left or right with the contents of the current file.

Automatic merging

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.