jj-rebase
Move commits to new parent
TLDR
Move given revisions to a different parent(s)
Move given revisions and all their descendants
Move all revisions in the branch containing given revisions
Move revisions to before and/or after other revisions
SYNOPSIS
jj rebase [--destination DESTINATION] [-b BRANCH...] [REVSETS...]
PARAMETERS
--destination <DESTINATION>
Revision to rebase changes onto. Defaults to working-copy parent.
-b, --branch <BRANCH>…
Branches to rebase instead of (or in addition to) revset arguments.
DESCRIPTION
jj rebase is a command in Jujutsu (jj), a Git-compatible distributed version control system designed for better usability than Git. It rebases specified changes or entire branches by moving them from their current parents to new destinations in the commit graph.
This operation preserves the content, commit messages, and relative order of rebased changes while updating change IDs, tree IDs, and commit IDs to reflect the new history. Unlike git rebase, which is limited to linear sequences from a base commit, jj rebase works seamlessly on arbitrary DAGs, making it ideal for complex workflows involving multiple branches or abandoned commits.
By default, without arguments, it rebases all descendants of the working copy onto the working copy's parent. Use --destination to specify where to place the changes, and positional revsets or -b for branches to select what to rebase. Conflicts are resolved non-interactively, but jj's operation recording allows easy continuation or abortion.
This command is essential for history rewriting, such as folding changes, integrating upstream updates, or cleaning up local commits before sharing. Always rebase private changes only to avoid disrupting collaborators.
CAVEATS
Rebasing shared/public changes rewrites history, breaking clones for others. Use jj abandon for public cleanups. Cannot rebase the destination itself or its ancestors.
EXAMPLES
jj rebase -d main
Rebase working-copy descendants onto main.
jj rebase -b feature-branch
Rebase entire feature-branch onto default destination.
HISTORY
Introduced in Jujutsu (jj) v0.1.0 (2022), developed by Martin von Zweigbergk at Google. Evolved to support Git interop and advanced DAG operations in v0.10+.
SEE ALSO
jj log(1), jj describe(1), jj squash(1), git-rebase(1)


