← Back to Home · Back to Tests

Jujutsu (jj) Command Cheatsheet

Quick reference for common Jujutsu commands

Key Concepts

Setup & Configuration

brew install jujutsu # Install on macOS
jj config set --user user.name "Your Name"
jj config set --user user.email "you@example.com"
jj git init --colocate # Initialize in existing Git repo
jj git clone <url> # Clone a repository

Viewing State

jj status # Show working copy changes
jj diff # Show changes in current commit
jj log # Show commit graph with change IDs
jj log -r <revset> # Show specific commits
jj evolog # Show how a change evolved over time

Creating & Navigating Changes

jj new # Finish current commit, start new one
jj new -m "message" # Create new commit with message
jj commit -m "message" # Describe current + new (like git commit)
jj describe -m "message" # Set/update commit message
jj edit <change-id> # Switch to editing a different commit
jj prev # Move to parent commit
jj next # Move to child commit
jj prev --edit # Edit parent directly

History Editing

jj squash # Squash @ into parent
jj squash --into <dest> # Squash @ into specific commit
jj squash -r <src> --into <dest> # Squash one commit into another
jj split # Split current commit into two
jj rebase -d <dest> # Rebase onto destination
jj abandon # Discard current change
jj fix # Apply formatters/linters

Working with Files

jj file list # List tracked files
jj file show <path> # Show file contents
jj file show <path> -r <rev> # Show file at specific revision
jj file track <path> # Explicitly track file
jj file untrack <path> # Stop tracking file

Bookmarks (Branches)

jj bookmark list # List all bookmarks
jj bookmark set <name> -r @ # Create or update bookmark (most common)
jj bookmark create <name> # Create new bookmark (fails if exists)
jj bookmark move <name> -r <rev> # Move bookmark
jj bookmark delete <name> # Delete bookmark
jj bookmark track <name>@<remote> # Track remote bookmark

Syncing with Remotes

jj git fetch # Fetch from remote
jj git push --bookmark <name> # Push bookmark
jj git push --bookmark <name> --allow-new # Push new bookmark (first time)
jj git push --change @ # Push with auto-generated bookmark

Conflict Resolution

jj status # Shows conflicted files
# Edit files manually to resolve, or:
jj resolve # Resolve all conflicts interactively
jj resolve <path> # Resolve specific file
jj resolve --list # List conflicted files
jj resolve --tool=:ours # Use our side
jj resolve --tool=:theirs # Use their side

Comparing Changes

jj diff # Show changes in @
jj diff -r <rev> # Show changes in specific commit
jj interdiff --from <a> --to <b> # Compare two versions
jj evolog -p # Show evolution with diffs

Safety & Undo

jj undo # Undo last operation
jj redo # Redo after undo
jj op log # Show operation history
jj op restore <id> # Restore to specific operation

Advanced Commands

jj absorb # Auto-distribute changes to appropriate commits
jj diffedit -r <rev> # Interactively edit commit's changes
jj parallelize <revset> # Convert linear stack to parallel
jj duplicate <change-id> # Copy commit
jj bisect run '<command>' # Find bug-introducing commit
jj metaedit # Modify commit metadata

Common Revsets

@ # Current working copy
@- # Parent of working copy
main # Bookmark/branch named "main"
main@origin # Remote bookmark
main..@ # Commits between main and @
trunk() # Main development branches
tags() # All tags
bookmarks() # All local bookmarks

Quick Workflow Examples

Starting new work:
jj new main # Start from main
# Make changes...
jj commit -m "Add feature" # Finish and describe
Fixing earlier commit:
jj edit <change-id> # Switch to that commit
# Make fixes...
jj new # Descendants auto-rebase!
Stacked PRs:
jj new main
# Work on part 1...
jj new # Start part 2
# Work on part 2...
jj bookmark set part1 -r @-
jj bookmark set part2 -r @
jj git push --bookmark part1 --allow-new
jj git push --bookmark part2 --allow-new

Resources