imediff2(1) An interactive fullscreen 2-way merge tool


imediff2 [-m] [-u] [-a] [-b] [-c] [-N new-file] [-o outputfile] {file1} {file2}


Merge two (slightly different) files interactively with a user friendly fullscreen interface in text mode.

Imediff2 shows the differences of given two files (in color if the terminal supports them), lets you scroll the file and toggle changes between old and new version one by one. If the 'unresolved' mode is enabled, you can optionally save both versions.

Additionally, if the $EDITOR environment variable is set or if /usr/bin/editor exists and is executable, you can also launch an external editor and manually edit the half-merged file before saving it, perhaps to resolve the 'unresolved' parts.

Empty lines are shown in reverse colors so you see that you can select them. If a line is missing completely from one file, imediff2 displays it as a reversed '?'. While it seems to take one line in the editing phase, it is naturally not saved into the output file.

To see a list of keyboard commands, hit h or ? in the editor.

The program exits with status 0 if the changes were saved, 1 if the merging was aborted and 2 if the parameters were invalid.


-o outputfile, --output=outputfile
Write output to given file. If missing, changes will not be saved.

-N, --new-file
Treat absent files as empty.

-m, --mono
Force monochrome display.

-u, --unresolved
Enable 'unresolved' mode (see above).

Start with version A (default).

Start with version B.

Start with unresolved changes (implies -u).

-h, --help
Show summary of options and exit.

-V, --version
Show version and exit.


The following keyboard commands are available in the editor.

h, ?
Show commands.

up, down, left, right
Move in document.

page up, page down
Move a screenfull.

Toggle selected change.

n, tab, space
Jump to next change.

Jump to previous change.

Set current chunk to version A.

Set current chunk to version B.

Set current chunk to unresolved.

Set all changes to version A.

Set all changes to version B.

Set all changes to unresolved.

Launch external editor.

Discard editor-made changes. (Available only after e.)

x, s
Save and exit.

q, ctrl+c
Exit without saving.

home, end
Jump to start or end.


This manual page as well as the program itself was written by Jarno Elonen (<[email protected]>). Unlike the program itself, which is licensed under the GNU General Public License (GPL) version 2 (or any later version, at your option), this document has been placed into the Public Domain.


Jarno Elonen.