# submerge

The Text Diff and Merge Tool

This chapter describes submerge, its features and how to use them.

## Overview

The screen shot below () shows submerges main window with all views visible. Normally you will not see them all at once.

The Original File View on the left is only used in a three way merge and even then it is hidden by default. You can unhide or hide it by using the Click Splitter widget on the left. In the usual diff case the Original File is unavailable and there is no Click Splitter widget.

The Left File View and the Right File View display the typical diff between two files and are usually both visible. You can temporarily hide or unhide the left or right file with the Hide/Unhide Left or Hide/Unhide Right check boxes. This is usefull to view more of the files content without scrolling.

submerge Main Window

With Hide/Unhide Line Diff you show or hide the Line Diff View below Left File and Right File. The Line Diff View is used to locate the differences between nearly identical lines of the Left File and the Right File. If the Line Diff View is enabled you can show a lines left and right content in vertical order by right clicking that line. The left line is displayed in the top line and the right line in the bottom line of the Line Diff View. You can now easily spot the difference between the two lines even if they only differ in a single character. Since it is usually not needed it is hidden by default.

At the bottom is the Merge Editor which shows the merged version of the left and right file while merging them. You can hide and unhide it with the bottom Click Splitter widget.

## Diff

Figure shows a typical diff in submerge. The lines in the left and the right file that differ are drawn with a red background. In the middle between the left and the right file you see the Difference Marker. Each difference between the two files is counted starting with 1. The difference number is the number between the lines of the Difference Marker. Those two lines mark the lines from the left and the right file that represent that difference.

submerge Diff

You can jump with the Next/Previous Difference buttons in the tool bar between the differences of the two files. The Current Difference is highlighted in black. You can also use the wheel of your mouse to jump to the next or previous difference.

In the status bar you can see the Difference Count. That is the number of differences of the two input files.

The Merge button is used to merge the two input file. Merging is explained in the next section.

## Merge

You can merge with two input files file (two way merge) or with three input files (three way merge). Press the merge tool bar button to open the Merge Editor. In the Merge Editor you see the current content of the merged file.

In case of a two way merge the merged file initially is the same as the left file. It has the same lines marked with a red background as the left file.

submerge Merge

To select a difference from the left or right file as content for the merged file simply double click the difference in the source file. In the Merge Editor the content changes to the selected difference and the difference gets a blue background. The blue background indicates that you have resolved the conflict for this difference in the left and right file. The left or right line marker of the Difference Marker turns to blue as well, depending on which file (left or right) you choose.

You can also edit the merged file in the Merge Editor. Double clicking a difference block in the Merge Editor does scroll the source files to the same difference and does make it the current difference. With the mouse wheel you can scroll to the next or the previous difference.

In case of a three way merge you may have a green background for a difference. The green background says that the lines are Identical to the Original file. Take a look at difference 3 in the screen shot. The left and right file are different and the left file is identical to the original file.

If one difference in a file is identical to the original file submerge does automatically select the difference lines from the other file for the merged file.

Selecting Save from the File menu will save the merged file under the name of the left file.

submerge