LinuxCommandLibrary

jj-edit

Edit the current commit

TLDR

Set the given revision as the working copy

$ jj edit [revset]
copy

SYNOPSIS

jj edit [-r REVISION] [-m MESSAGE] [--insert] [--reset-author] [REVISION]

PARAMETERS

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

-m, --message MESSAGE
    Set or edit the commit message directly

--insert
    Insert new changes before the revision instead of editing it

--reset-author
    Reset author to current committer identity

DESCRIPTION

The jj edit command in Jujutsu (jj), a Git-compatible distributed version control system, allows users to begin editing a specific revision. It switches the working copy to the target revision, enabling modifications to its changes, tree, or description. After editing, use jj continue to commit updates or jj abort to discard them.

This operation is central to jj's rewrite-friendly workflow, supporting non-linear histories without forcing linear rebases. Unlike Git's amend, jj edit integrates seamlessly with its operation log, automatically handling conflicts and concurrent changes. It's ideal for refining commits interactively, fixing mistakes, or restructuring history.

By default, it targets the working-copy revision (@). Specify a revision with -r or positional argument. Options like --insert add new changes before the revision instead of overwriting it.

CAVEATS

Editing revisions rewrites history; avoid on shared public branches. Requires jj installed and a repository initialized with jj init. Interactive editing needs an external editor configured via JJ_EDITOR.

WORKFLOW EXAMPLE

jj edit -r abc123 → edit files → jj continue

EDITOR INTEGRATION

Uses $EDITOR or $VISUAL; supports jj config edit for repo-specific settings.

HISTORY

Introduced in Jujutsu 0.1.0 (2022) by Martin von Zweigbergk at Google. Evolved from Git's interactive rebase concepts but optimized for jj's change-centric model. Actively developed; latest features in v0.20+ improve conflict resolution.

SEE ALSO

jj(1), git commit --amend(1), jj describe(1), jj squash(1)

Copied to clipboard