LinuxCommandLibrary

jj-diffedit

Edit a revision's diff interactively

TLDR

Edit changes in the current revision with a diff editor

$ jj diffedit
copy

Edit changes in a given revision
$ jj diffedit [[-r|--revision]] [revset]
copy

Edit changes comparing a "from" revision to a "to" revision
$ jj diffedit [[-f|--from]] [from_revset] [[-t|--to]] [to_revset]
copy

Edit only specific paths (unmatched paths remain unchanged)
$ jj diffedit [filesets]
copy

Use a specific diff editor
$ jj diffedit --tool [name]
copy

Preserve content instead of diff when rebasing descendants
$ jj diffedit --restore-descendants
copy

SYNOPSIS

jj diffedit [OPTIONS] [PATHS...]

PARAMETERS

-r, --revision <REVISION>
    Revision to edit (default: working copy)

--from <REVISION>
    Show changes since this revision (default: working copy minus edited changes)

-t, --tool <TOOL>
    Interactive diff tool (default: auto; options: auto, builtin, delta)

--config <CONFIG>
    Configuration file to use (default: ~/.config/jj/jj.toml)

-h, --help
    Print help information

-V, --version
    Print version information

DESCRIPTION

The jj diffedit command launches an interactive editor for the diff of the working copy (or specified revision) in Jujutsu (jj), a Git-compatible version control system. It allows users to stage, unstage, or discard individual hunks, reorder changes, and resolve merge conflicts visually.

By default, it uses a built-in curses-based interface but supports external tools like delta or custom editors via --tool. This is particularly useful for complex changesets, enabling fine-grained control without manual patch editing or repeated jj diff invocations.

Unlike Git's staging tools, jj diffedit operates on the working-copy state directly, leveraging jj's immutable DAG model for safe, non-destructive edits. It integrates seamlessly with jj's workflow, automatically committing changes post-edit if desired.

CAVEATS

Requires a terminal supporting curses for builtin tool; external tools must be installed and configured. Not suitable for very large diffs due to memory usage. Changes are auto-saved on exit but verify with jj diff.

EXAMPLE USAGE

jj diffedit # Edit all working copy changes interactively
jj diffedit --revision abc123 src/ # Edit specific path in revision

TOOL CONFIGURATION

Set in jj.toml: [diff-edit] tool = "delta" for persistent external tool use.

HISTORY

Introduced in Jujutsu (jj) v0.1.0 (2022) by Martin von Zweigbergk as part of jj's advanced diff workflow. Evolved with tool support in v0.10+; active development on GitHub (martinvonz/jj).

SEE ALSO

jj(1), git-difftool(1), delta(1)

Copied to clipboard