Skip to content

Jujutsu (jj) - Git-Compatible Version Control Cheatsheet

Jujutsu (jj) - Git-Compatible Version Control Cheatsheet

Jujutsu (jj) is a modern version control system that is Git-compatible — it uses a Git repository as its backend, so you can adopt it on existing repos and interoperate with teammates using Git. Its model is different and, for many, simpler: the working copy is itself a commit (no separate staging area), conflicts are first-class objects you can commit and resolve later, and every operation is recorded in an operation log you can undo. There are no branches in the Git sense by default; you work with changes identified by stable change IDs.

Installation

PlatformCommand
Cargocargo install --locked jj-cli
macOS (Homebrew)brew install jj
Arch Linuxsudo pacman -S jujutsu
Nixnix profile install nixpkgs#jujutsu
Windows (Scoop)scoop install jujutsu
Verifyjj --version

Setup

CommandDescription
jj config set --user user.name "Your Name"Set your name
jj config set --user user.email "you@example.com"Set your email
jj git init --colocateInit jj in an existing Git repo (keeps .git)
jj git clone <url>Clone a Git repo with jj
jj git initCreate a new jj repo (native backend)

Core Concepts

TermMeaning
ChangeA logical change with a stable change ID (survives rewrites)
CommitA snapshot; the working copy is always a commit (@)
@The current working-copy commit
RevsetA query language for selecting commits
Operation logHistory of repo operations, each undoable
BookmarkA named pointer (maps to a Git branch on push)

Everyday Workflow

CommandDescription
jj statusShow working-copy changes
jj logShow the commit graph
jj diffDiff the working-copy commit
jj describe -m "msg"Set/replace the current commit’s message
jj newStart a new change on top of the current one
jj new <rev>Start a new change on top of a specific commit
jj edit <rev>Make an existing commit the working copy
jj commit -m "msg"Describe @ and start a new change (Git-like)

Moving & Editing History

CommandDescription
jj squashMove changes from @ into its parent
jj squash -iInteractively choose what to squash
jj splitSplit the current commit into two
jj rebase -d <dest>Rebase a change onto a destination
jj abandon <rev>Drop a commit
jj duplicate <rev>Copy a commit elsewhere

The Killer Feature: Undo

CommandDescription
jj op logList every operation performed
jj undoUndo the last operation
jj op restore <id>Restore the repo to a previous operation state

Because every command is an operation, almost anything can be undone — including rebases and abandons.

Bookmarks & Git Interop

CommandDescription
jj bookmark create main -r @Create a bookmark (≈ Git branch)
jj bookmark set main -r @Move a bookmark to a commit
jj git fetchFetch from the Git remote
jj git pushPush bookmarks to the Git remote
jj git push -c @Create a remote branch from the current change

Revsets (Selecting Commits)

RevsetSelects
@Working-copy commit
@-Parent of the working copy
mainThe commit a bookmark points to
mine()Your commits
ancestors(@)All ancestors of @
jj log -r "description(glob:'fix*')"Commits whose message matches

Common Workflows

# Adopt jj in an existing Git repo, keep working with Git remotes
jj git init --colocate
jj log

# Make a change without staging — just edit files, then describe
# (files are auto-snapshotted into @)
jj describe -m "Add feature"
jj new                       # start the next change

# Oops — undo the last thing you did (even a rebase)
jj undo

# Push the current change as a branch for review
jj bookmark create feature -r @
jj git push -c @

jj vs Git

AspectJujutsu (jj)Git
Staging areaNone (working copy is a commit)Index/staging
ConflictsFirst-class, committableMust resolve before proceeding
UndoUniversal via op logReflog (partial)
BranchesBookmarks (optional)Branches (central)
BackendGit-compatibleGit

Resources