About Subtractive Merge

Technote (FAQ)


Question

This technote explains how to undo a merge in cases where the change that needs to be removed is not the latest version when using IBM® Rational® ClearCase®. This functionality allows you to perform a merge that will exclude versions with bad changes on the same branch.

Answer

To undo a merge when the change you need to remove is not the latest one will require a subtractive merge.

A subtractive merge can be performed to exclude or bypass bad versions on a branch without actually removing the bad versions. Cleartool merge using the -delete option will allow a user to merge from the last known good version to a new version on the same branch which excludes the work done in the versions identified as bad versions. This merge must be performed from the command line, it does not create a merge arrow, the arrow can be created manually.

Here is the syntax for the commands:

  • Subtractive merge:

    cleartool merge -to filename -delete -ver \main\branch\version_number

  • Merge arrow:

    cleartool merge -ndata -to filename -ver \main\branch\version_number


The -delete option invokes a subtractive merge, which is the opposite of a selective merge.


A selective merge adds to the checked-out version the changes made in one or more other versions. A subtractive merge removes from the checked-out version the changes made in one or more of its predecessors.


The example below is merging from version \main\4 to new version \main\12, excluding work done in versions 5, 6, 7, 8 and 9. The subtractive merge will not modify versions 10 or 11, but the latest version on the branch will be the result of the merge, which in the example is version 12.

  1. First checkout the destination (or target) file version, which in this example is version 11:
    • cleartool co -nc foo.c
      Checked out "foo.c" from version "\main\11".

  2. To undo the changes made in versions 5 - 9 of file foo.c, while retaining all the changes made before version 5 and after version 9, you can issue this command:
    • cleartool merge -to foo.c -delete -ver \main\5 \main\9

  3. Then draw a merge arrow:
    • cleartool merge -ndata -to foo.c -ver \main\4
      Recorded merge of "foo.c".

  4. Verfiy the results of the subtractive merge, while the version is still checked out, then checkin the new version:
    • cleartool ci -nco foo.c
      Checked in "foo.c" version "\main\12".

Refer to the IBM Rational ClearCase Command Reference, under the topics of Removing the contributions of some versions and Scenario: Removing the contributions of some versions or run cleartool man merge.

Cross reference information
Segment Product Component Platform Version Edition
Software Development Rational ClearCase Merging

Rate this page:

(0 users)Average rating

Add comments

Document information


More support for:

Rational ClearCase
Merging

Software version:

7.0, 7.0.1, 7.1, 7.1.1, 7.1.2

Operating system(s):

AIX, HP-UX, IRIX, Linux, Solaris, Windows

Reference #:

1123001

Modified date:

2012-08-06

Translate my page

Machine Translation

Content navigation