Keywords: KDE, kdeextragear, kdiff3, diff, merge, CVS, triplediff, compare, files, directories, version control, three-way-merge, in-line-differences, synchronise, kpart, kio, networktransparent, editor, white space, comments

File Comparison And Merge
Prev
Next

## Chapter 2. File Comparison And Merge

## Command-Line Options

### Comparing 2 files:

       kdiff3 file1 file2

### Merging 2 files:

       kdiff3 file1 file2 -m
       kdiff3 file1 file2 -o outputfile

### Comparing 3 files:

       kdiff3 file1 file2 file3

### Merging 3 files:

       kdiff3 file1 file2 file3 -m
       kdiff3 file1 file2 file3 -o outputfile

Note that `file1` will be treated as base of `file2` and `file3`.

### Special case: Files with the same name

If all files have the same name but are in different directories, you can reduce typework by specifying the filename only for the first file. E.g.:

       kdiff3 dir1/filename dir2 dir3

### Commandline for starting a directory comparison or merge:

This is very similar, but now it's about directories.

       kdiff3 dir1 dir2
       kdiff3 dir1 dir2 -o destdir
       kdiff3 dir1 dir2 dir3
       kdiff3 dir1 dir2 dir3 -o destdir

For directory comparison and merge you can continue to read here.

### Other command line options

To see all available command line options type

    kdiff3 --help

Example output:

    Options:
      -m, --merge               Merge the input.
      -b, --base file           Explicit base file. For compatibility with certain tools.
      -o, --output file         Output file. Implies -m. E.g.: -o newfile.txt
      --out file                Output file, again. (For compatibility with certain tools.)
      --auto                    No GUI if all conflicts are auto-solvable. (Needs -o file)
      --qall                    Don't solve conflicts automatically. (For compatibility...)
      --L1 alias1               Visible name replacement for input file 1 (base).
      --L2 alias2               Visible name replacement for input file 2.
      --L3 alias3               Visible name replacement for input file 3.
      -L, --fname alias         Alternative visible name replacement. Supply this once for every input.
      --cs string               Override a config setting. Use once for every setting. E.g.: --cs "AutoAdvance=1"
      --confighelp              Show list of config settings and current values.
      --config file             Use a different config file.

The option `--cs` allows you to adjust a configuration value that is otherwise only adjustable via the configure dialogs. But be aware that when KDiff3 then terminates the changed value will be stored along with the other settings. With `--confighelp` you can find out the names of the available items and current values.

Via `--config` you can specify a different config file. When you often use KDiff3 with completely different setups this allows you to easily switch between them.

### Ignorable command line options

Many people want to use KDiff3 with some version control system. But when that version control system calls KDiff3 using command line parameters that KDiff3 doesn't recognise, then KDiff3 terminates with an error. The integration settings allow to specify command line parameters that should be ignored by KDiff3. They will appear in the usage help like in this example:

      --foo                     Ignored. (User defined.)

Command line options to ignore:

  A list of options, separated via semicolon ';'. When one of these options appears on the commandline, then KDiff3 will ignore it and run without reporting an error. (Default is "u;query;html;abort").

When this isn't enough, then it is recommended to write a shell script that does the option translation.

Prev
Next
Contents
More Features
Open-Dialog
Up

Would you like to make a comment or contribute an update to this page?
Send feedback to the KDE Docs Team