LinuxCommandLibrary

editdiff

Edit diffs with a visual editor

SYNOPSIS

editdiff [-h|-V] [file…]

PARAMETERS

-h, --help
    Display usage summary and exit

-V, --version
    Output version information and exit

DESCRIPTION

editdiff is a utility from the patchutils package designed to interactively modify unified diff files. It reads unified diffs from standard input or specified files, identifies changed files and hunks, and invokes your default editor ($EDITOR, defaults to vi) on temporary files containing each hunk's context and changes. You can edit the diff content directly—adjust lines, fix offsets, or resolve rejects—then save. editdiff recombines edited hunks into a coherent unified diff output, preserving headers and metadata.

This is invaluable for refining patches before applying with patch(1), handling multi-file diffs, or customizing contributions. It splits oversized hunks automatically and processes files sequentially, prompting for each. Supports stdin for piping, e.g., from git diff. Limitations include unified diffs only; context diffs unsupported.

CAVEATS

Requires $EDITOR environment variable (defaults to vi); handles unified diffs only—no context or normal diffs; may split large hunks; temporary files in /tmp; not for binary files.

USAGE EXAMPLE

git diff > changes.patch; editdiff changes.patch
Edits each hunk in vi, outputs refined patch to stdout.

STDIN USAGE

git format-patch --stdout | editdiff
Pipes patch series for interactive refinement.

HISTORY

Developed by Joe Perches as part of patchutils (first released ~2005); enhances diff/patch workflows; maintained sporadically, available in most distros via patchutils package.

SEE ALSO

diff(1), patch(1), interdiff(1), dehtmldiff(1)

Copied to clipboard