LinuxCommandLibrary

kdiff3

TLDR

Compare two files

$ kdiff3 [file1] [file2]
copy
Three-way comparison
$ kdiff3 [base] [file1] [file2]
copy
Compare directories
$ kdiff3 [dir1] [dir2]
copy
Merge with output
$ kdiff3 [base] [file1] [file2] -o [merged]
copy
Auto-select non-conflicting
$ kdiff3 [base] [file1] [file2] --auto
copy

SYNOPSIS

kdiff3 [options] [files/directories...]

DESCRIPTION

KDiff3 is a file and directory comparison and merge tool. It supports two-way and three-way comparisons, making it suitable for resolving merge conflicts and reviewing changes.
KDiff3 highlights differences with colors and allows selecting which version to use for each conflict. It integrates with version control systems as a merge tool.

PARAMETERS

-o file

Output merged file.
--auto
Automatically select non-conflicting changes.
-m, --merge
Merge mode.
--cs setting=value
Configuration setting.
--qall
Quiet (auto-mode only).
-L1, -L2, -L3 label
Labels for inputs.

GIT INTEGRATION

$ # Configure as merge tool
git config --global merge.tool kdiff3
git config --global mergetool.kdiff3.path /usr/bin/kdiff3

# Configure as diff tool
git config --global diff.tool kdiff3
copy

CAVEATS

Requires KDE libraries. Three-way merge needs common ancestor. Large files may be slow. Binary files not compared.

HISTORY

KDiff3 was created by Joachim Eibl as a Qt/KDE application for comparing and merging files. It became a popular choice for resolving version control conflicts.

SEE ALSO

diff(1), meld(1), vimdiff(1), git-mergetool(1)

Copied to clipboard