14.1 How Merging Works

A merge combines the contents of two or more files or directories into a single new file/directory. The ClearCase merge algorithm uses the following files during a merge (see Figure 44):

Figure 44 Versions Involved in a Typical Merge

To merge files and directories, ClearCase takes the following steps:

  1. It identifies the base contributor.

  2. It compares each contributor against the base contributor. (See Figure 45.)

  3. For any line that is unchanged between the base contributor and any other contributor, it copies the line to the merge output file.

  4. For any line that has changed between the base contributor and one other contributor, it accepts the change in the contributor; depending on how you started the merge operation, ClearCase may copy the change to the merge output file. However, you can disable the automated merge capability for any given merge operation. If you disable this capability, you must approve each change to the merge output file.

  5. For any line that has changed between the base contributor and more than one other contributor, ClearCase requires that you resolve the conflicting difference.

Figure 45 ClearCase Merge Algorithm

To merge versions, you can use the GUI tools, described briefly in the next section, or the command-line interface, described in Using the Command Line to Merge Elements.

Using the GUI to Merge Elements

ClearCase provides three graphical tools to help you merge elements:

The Merge Manager manages the process of merging one or more ClearCase elements. It automates the processes of gathering information for a merge, starting a merge, and tracking a merge. It can also save and retrieve the state of a merge for a set of elements.

You can use the Merge Manager to merge from many directions:

You can start the Merge Manager in several ways:

The Diff Merge utility shows the differences between two or more versions of file or directory elements. Use this tool to compare up to 16 versions at a time, navigate through versions, merge versions, and resolve differences between versions.

You can start Diff Merge in several ways:

The Version Tree Browser displays the version tree for an element. The version tree is useful when merging to do the following:

The merge can be recorded with a merge arrow, which is implemented as a hyperlink of type Merge.

You can start the Version Tree Browser in several ways:

Using the Command Line to Merge Elements

Use the following commands to perform merges from the command line:

For more information on these commands, see the Command Reference.