IPnom Home • Manuals • ClearCase

 Rational ClearCase Commands Reference

ClearCase Stuff:ClearCase LinksClearCase BooksClearCase Commands ReferenceClearCase ForumsClearCase News
Keyword Live Search (10 results max):
 Type in part of a ClearCase command in the search box.
Commands Index:


Compares or merges text files


ProductCommand type
ClearCase LTcommand



  • UNIX only—Compare files:
    cleardiff [ –tin·y | –win·dow] [ –dif·f_format
    | –ser·ial_format | –col·umns n ]
    [ –hea·ders_only | –qui·et | –sta·tus_only ] [ –b·lank_ignore ] pname1 pname2 ...

  • UNIX only—Merge files:
    cleardiff –out output-pname [ –bas·e pname ]
    [ –q·uery | –qal·l | –abo·rt ]
    [ –tin·y | –win·dow] [ –dif·f_format
    | –ser·ial_format | –col·umns n ]
    [ –hea·ders_only | –qui·et | –sta·tus_only ] [ –b·lank_ignore ] [-favor·_contrib n (base=1,...) ] pname1 pname2 ...

  • Windows only—Compare files:
    cleardiff [ –dif·f_format | –ser·ial_format | –col·umns n ]
    [ –hea·ders_only | –qui·et | –sta·tus_only ] [ –b·lank_ignore ] pname1 pname2 ...

  • Windows only—Merge files:
    cleardiff –out output-pname [ –bas·e pname ]
    [ –q·uery | –qal·l | –abo·rt ]
    [ –dif·f_format | –ser·ial_format | –col·umns n ]
    [ –hea·ders_only | –qui·et | –sta·tus_only ][ –b·lank_ignore ] [-favor·_contrib n (base=1,...) ] pname1 pname2 ...


cleardiff is a line-oriented file comparison and merge utility with a character-based user interface. It can process up to 32 files. cleardiff has some alternative interfaces:

  • On all platforms, cleardiff can be invoked with the cleartool diff command to perform a file comparison, or with the cleartool merge subcommand to perform a merge.
  • On UNIX only, ClearCase and ClearCase LT include a corresponding GUI tool, xcleardiff. This tool can be invoked with the diff –graphical and merge –graphical subcommands and through xclearcase.

Note: You cannot compare directory versions with cleardiff; you must use diff. (The diff command first analyzes the directory versions, then calls cleardiff, using the type manager mechanism.)

For discussions of how files are compared and merged, see the diff and merge reference pages.


–tin·y | –win·dow (UNIX only)
–window creates a child process, which displays a side-by-side report in a separate 120-character difference window. The diff command returns immediately. To exit the difference window, type a UNIX interrupt character (typically, CTRL+C).

–tiny is the same as –window, but uses a smaller font in a 165-character difference window.

–dif·f_format | –ser·ial_format | –col·umns n
–diff_format reports both headers and differences in the same style as UNIX diff, and suppresses the file summary from the beginning of the report.

–serial_format reports differences with each line containing output from a single file, instead of using a side-by-side format.

–columns establishes the width of a side-by-side report. The default width is 80 (that is, only the first 40 or so characters of corresponding difference lines appear). If n does not exceed the default width, this option is ignored.

Note: Any of the following options can be invoked with the diff –options or merge –options commands.

–hea·ders_only | –qui·et | –sta·tus_only
–headers_only lists only the header line of each difference. The difference lines themselves are omitted.

–quiet suppresses the file summary from the beginning of the report.

–status_only suppresses all output, returning only an exit status: a 0 status indicates that no differences were found; a 1 status indicates that one or more differences were found. This option is useful in shell scripts.

When comparing and merging files, ignores extra white space characters in text lines: leading and trailing white space is ignored altogether; internal runs of white space characters are treated like a single <SPACE> character.

-favor·_contrib n (base=1,...)
(merge only) Specifies the contributor, in numeric value, to be used to fill in the non-changed areas of the merge output file. This option is only valid when both the –out and –b·lank_ignore options are used. If this option is not specified, the base contributor will be used.

–out output-pname
Stores the output of a merge in file output-pname. This file is not used for input, and must not already exist.

–bas·e pname
Makes file pname the base contributor for the comparison or merge. If you omit this option, the pname1 argument becomes the base contributor, and the comparison or merge automatically runs with the –qall option invoked.

–q·uery | –qal·l | –abo·rt
–query turns off automatic merging for nontrivial merges (where two or more contributors differ from the base contributor) and prompts you to proceed with every change in the from-versions. Changes in the to-version are accepted unless a conflict exists.

–qall turns off automatic acceptance of changes in which only one contributor differs from the base contributor. cleardiff prompts for confirmation of such changes, as it does when two or more contributors differ from the base contributor.

–abort is intended for use with scripts or batch jobs that involve merges. It allows completely automatic merges to proceed, but aborts any merge that requires user interaction.

pname1 pname2 ...
The pathnames of contributors to compare or merge. These can be view-extended or version-extended pathnames. Only one such argument is required if you also specify a file with the –base option.


The UNIX examples in this section are written for use in csh. If you use another shell, you may need to use different quoting and escaping conventions.

The Windows examples that include wildcards or quoting are written for use in cleartool interactive mode. If you use cleartool single-command mode, you may need to change the wildcards and quoting to make your command interpreter process the command appropriately.

In cleartool single-command mode, cmd-context represents the UNIX shell or Windows command interpreter prompt, followed by the cleartool command. In cleartool interactive mode, cmd-context represents the interactive cleartool prompt.

Note: In the UNIX examples that follow, arguments and output that show multicomponent VOB tags are not applicable to ClearCase LT, which recognizes only single-component VOB tags. In this manual, a multicomponent VOB tag is by convention a two-component VOB tag of the form /vobs/vob-tag-leaf—for example, /vobs/src. A single-component VOB tag consists of a leaf only—for example, /src. In all other respects, the examples are valid for ClearCase LT.

  • Compare the current version of an element with a scratch copy in your home directory.

    z:\myvob> cleardiff msg.c C:\users\susan\msg.c.tmp 
    <<< file 1: msg.c
    >>> file 2: C:\users\susan\msg.c.tmp
    ----------[changed 5]--------|-----------[changed to 5]------------
           static char msg[256]; | static char msg[BUFSIZ];
    ---------[changed 9-11]------|-----------[changed to 9]------------
                   env_user(),   | env_user(), env_home(), e+
                   env_home(),   |-
                   env_time() ); |

  • Compare the same files, this time in a separate window and using a small font.

    % cleardiff -tiny msg.c ~/msg.c.tmp 

  • Compare the most recent versions on two branches of an element.

    y:\lib_vob> cleardiff util.c@@\main\LATEST util.c@@\main\rel2_bugfix\LATEST 



ClearCase Links • ClearCase Books • ClearCase Commands Reference • ClearCase Forums • ClearCase News