LinuxCommandLibrary

jj-commit

Create new commit

TLDR

Open editor to write the commit message and then create a new empty commit on top

$ jj commit
copy

Commit with the given message
$ jj commit [[-m|--message]] "[message]"
copy

Interactively choose which changes to include
$ jj commit [[-i|--interactive]]
copy

SYNOPSIS

jj commit [OPTIONS] [PATHSPEC...]

PARAMETERS

-m, --message <MESSAGE>
    Commit message to use (opens editor if omitted)

-r, --revision <REVISION>
    Parent revision for new commit (default: working-copy @)

--change-id <CHANGE_ID>
    Reuse specified change ID for tracking

--user <USER>
    Username for this commit (overrides config)

-i, --interactive
    Interactively select changes to include

--no-edit
    Skip editor for message; requires -m

--allow-large-git
    Permit git-compatible commits >100MB

--strip-trailing-cr
    Remove carriage returns from paths

-q, --quiet
    Reduce output verbosity

-v, --verbose
    Increase output verbosity

DESCRIPTION

The jj commit command in Jujutsu (jj), a Git-compatible distributed version control system, creates a new commit incorporating unstaged changes from the working copy. Unlike git commit, which requires staging, jj maintains the working copy as its own commit (named @). Running jj commit automatically advances the working copy by snapshotting current changes into a new commit on top, leaving the working tree clean.

This design supports concurrent branches and automatic rebase/merge conflict resolution. By default, it includes all changes unless paths are specified. Use -m for inline messages or omit for editor. Interactive mode (-i) lets you select hunks, similar to git add -p. jj commit promotes linear history and simplifies workflows like undoing changes with jj undo.

Key benefits include no staging area, change IDs for tracking across rebases, and seamless Git interop via jj git. Ideal for large repos or teams needing robust concurrency.

CAVEATS

Always creates new commit atop working-copy; use jj describe to amend working-copy message. Requires jj repo (run jj init). Paths limit to subpaths; no staging like Git.

EXAMPLES

jj commit -m "Add feature"
jj commit -i (select hunks)
jj commit src/ (commit subdirectory only)

KEY DIFFERENCES FROM GIT

No index/staging; working-copy is committed state. Supports change IDs for idempotent rebases. jj commit leaves clean tree automatically.

HISTORY

Introduced in Jujutsu v0.1.0 (March 2022) by Martin von Zweigbergk. Evolved from hg-speedbranch project; active development focuses on Git parity and concurrency. Reached v0.20+ by 2024 with refined commit model.

SEE ALSO

git-commit(1), jj-describe(1), jj-log(1), jj(1)

Copied to clipboard