LinuxCommandLibrary

jj-abandon

Delete Jujutsu changesets permanently

TLDR

Abandon revisions specified by given revsets (e.g. B::D, A..D, B|C|D, etc.)

$ jj abandon [revsets]
copy

Abandon revisions, without deleting their bookmarks and moving them to the parent revisions instead
$ jj abandon --retain-bookmarks [revsets]
copy

Abandon revisions, without modifying the contents of their children
$ jj abandon --restore-descendants [revsets]
copy

SYNOPSIS

jj abandon [OPTIONS] <REVSET>…

PARAMETERS

-m, --message <MESSAGE>
    Set the message for the abandon commit (default: auto-generated)

--ignore-missing-rev
    Don't error if revset matches no revisions or revisions aren't empty/unpushed

-r, --revision <REVISION>
    Revset to abandon (deprecated; use positional REVSET instead)

DESCRIPTION

The jj abandon command in Jujutsu (jj), a Git-compatible version control system, removes specified changes (commits) from the repository's history.

Unlike Git's destructive rewrites, jj uses an immutable operation-based model, making abandon safe—it advances the working-copy state without the targeted revisions, leaving the original commits accessible but hidden.

Target revisions are specified via a revset (e.g., @- for the previous change). By default, only empty changes (no working-copy diffs) or unpushed changes can be abandoned. Use --ignore-missing-rev to force abandonment of non-empty or pushed changes, but this risks data loss if not careful.

Common use: cleaning up temporary changes created with jj new or jj describe. After abandoning, the repo state reflects the new history, and tools like jj log show the updated graph.

CAVEATS

Only abandons empty or unpushed changes by default.
--ignore-missing-rev can lead to data loss on shared repos.
Abandoned changes remain in Git history if pushed.

EXAMPLES

jj abandon @-
Abandon the previous change.

jj abandon 'draft()'
Abandon all draft changes.

jj abandon --message 'Dropped temp' HEAD~1
Abandon with custom message.

HISTORY

Introduced in Jujutsu v0.1.0 (2022) by Martin von Zweigbergk as core workflow for safe change deletion, evolving from hg-abort concepts with Git compatibility.

SEE ALSO

jj(1), git-rebase(1), git-commit(1)

Copied to clipboard