⚙️ Theoai Jujutsu

2installs

This skill helps you manage jj version control tasks, from commits and history edits to bookmarks and remote interop, with a simple mental model.

QUICK INSTALL
npx playbooks add skill get-theo-ai/agent-skills --skill theoai-jujutsu

Theoai Jujutsu instructions

Theo Ai's Jujutsu (jj) Version Control Guide

Jujutsu is a modern, Git-compatible version control system that
provides a simpler mental model and powerful history editing
capabilities. This guide covers jj usage in colocated mode (jj + git
sharing the same repository).

When to Use

Use this skill when working with version control in a jj repository:

  • Creating, describing, or editing commits
  • Viewing repository status, history, or diffs
  • Rebasing, squashing, or splitting commits
  • Managing bookmarks (jj's equivalent of branches)
  • Pushing to or fetching from Git remotes
  • Resolving conflicts
  • Recovering from mistakes with operation history
  • Any task involving jj commands

Core Concepts

Key Differences from Git

| Concept | Git | Jujutsu |
|---------------------|---------------------------------|-------------------------------------------------|
| Staging area | Explicit git add required | None - working copy IS a commit |
| Working copy | Detached from commits | Always a commit (@) |
| Branches | Named refs that must be managed | Bookmarks (optional, auto-follow rewrites) |
| Stash | Separate stash stack | Not needed - just create new commits |
| Amending | git commit --amend | Just edit files - changes auto-apply to @ |
| Conflicts | Block operations until resolved | Tracked as values, don't block operations |
| History editing | Requires careful rebasing | Descendants auto-rebase when you modify history |

The Working Copy Model

In jj, your working copy (@) is always a commit. Every file change
is automatically part of this commit - no staging required.

parent commit (@-)
      |
      v
  @ (working copy) <-- your edits apply here automatically

When you run jj new, you create a new empty commit on top of @,
and that becomes your new working copy.

Identity: Change ID vs Commit ID

Every commit in jj has two identifiers:

  • Change ID: Stable across rewrites (e.g., kpqxywon)
  • Commit ID: Changes when commit content changes (like git SHA)

Use Change IDs when referring to commits - they survive rebases and
amendments.

Terminology Mapping

| Git Term | jj Term | Notes |
|---------------|-----------------|--------------------------------------------------|
| branch | bookmark | Bookmarks auto-follow when commits are rewritten |
| HEAD | @ | The working copy commit |
| HEAD~1 | @- | Parent of working copy |
| checkout | edit or new | edit moves @, new creates child commit |
| staging/index | (none) | Not applicable - all changes are tracked |
| stash | (none) | Just create a new commit instead |
| remote branch | name@origin | e.g., main@origin |
| tag | tag | Lightweight tags only; annotated tags need Git |

Git-to-jj Command Translation

Everyday Commands

| Git | jj | Notes |
|------------------------------------|------------------------|------------------------------------|
| git status | jj st | Shows working copy status |
| git diff | jj diff | Diff of working copy |
| git diff --staged | (none) | No staging area |
| git log --graph | jj log | Shows commit graph |
| git show <commit> | jj show <rev> | Show commit details |
| git add . && git commit -m "msg" | jj commit -m "msg" | Commit and create new working copy |
| git commit --amend | (just edit files) | Working copy auto-amends |
| git commit --amend -m "msg" | jj describe -m "msg" | Change commit message |

Branching & Navigation

| Git | jj | Notes |
|--------------------------|---------------------------------------|-----------------------------------|
| git branch | jj bookmark list | List bookmarks |
| git branch <name> | jj bookmark create <name> | Create bookmark at @ |
| git checkout <branch> | jj edit <rev> | Move @ to revision |
| git checkout -b <name> | jj new && jj bookmark create <name> | New commit + bookmark |
| git switch - | jj edit @- | Go to parent |
| git stash | jj new | Start new commit (old work stays) |
| git stash pop | jj edit <prev> | Go back to previous commit |

Tags

| Git | jj | Notes |
|-----------------------------|-------------------------------------|----------------------------------|
| git tag -l | jj tag list | List tags |
| git tag <name> <rev> | jj tag set <name> -r <rev> | Create lightweight tag |
| git tag -f <name> <rev> | jj tag set <name> -r <rev> --allow-move | Move existing tag deliberately |
| git tag -d <name> | jj tag delete <name> | Delete local tag |
| git tag --contains <rev> | jj tag list -r '<rev>::' | Tags whose targets descend from rev |
| git tag --merged <rev> | jj tag list -r '::<rev>' | Tags whose targets are ancestors of rev |
| git tag -a <name> <rev> | Use git tag -a | jj cannot create annotated tags |

History Editing

| Git | jj | Notes |
|----------------------------|-----------------------------------------------|------------------------------|
| git rebase -i | jj squash, jj split, jj edit | Various commands |
| git rebase <onto> | jj rebase -d <dest> | Rebase current commit |
| git cherry-pick <commit> | jj new <dest> && jj restore --from <source> | Copy changes |
| git reset --hard | jj restore | Discard working copy changes |
| git reset --soft HEAD~1 | jj squash | Fold into parent |
| git revert <commit> | jj backout -r <rev> | Create inverse commit |

Remote Operations

| Git | jj | Notes |
|-------------------------------|--------------------------------------------|------------------------|
| git fetch | jj git fetch | Fetch from remotes |
| git pull | jj git fetch && jj rebase -d main@origin | Fetch + rebase |
| git push | jj git push -b <bookmark> | Push specific bookmark |
| git push -u origin <branch> | jj git push --bookmark <name> | Push and track |

Other Commands

| Git | jj | Notes |
|--------------------|---------------------------|------------------------------|
| git blame <file> | jj file annotate <file> | Show line-by-line authorship |
| git clean -fd | jj restore | Remove untracked changes |
| git reflog | jj op log | Operation history |

Essential Commands

Viewing State

# Show working copy status
jj status
jj st                          # short form

# Show commit log (graph view)
jj log
jj log -r 'all()'              # show all commits
jj log -n 20                   # limit to 20 commits
jj log -r 'bookmarks()'        # commits with bookmarks

# Show diff
jj diff                        # working copy changes
jj diff --git                  # git-compatible format
jj diff -r <rev>               # diff of specific commit
jj diff --from <rev1> --to <rev2>  # diff between revisions

# Show commit details
jj show                        # current commit
jj show <rev>                  # specific commit

Creating and Describing Commits

# Describe current working copy (set/update message)
jj describe -m "feat: add user authentication"
jj desc -m "fix: resolve login issue"    # short form

# Create new empty commit on top of current
jj new
jj new -m "feat: starting new feature"   # with message

# Create new commit on specific parent(s)
jj new <rev>                   # single parent
jj new main                    # based on main
jj new <rev1> <rev2>           # merge commit (multiple parents)

# Commit current changes and start new working copy
jj commit -m "feat: complete implementation"
# (equivalent to: jj describe -m "msg" && jj new)

Navigating History

# Edit (move working copy to) a specific commit
jj edit <rev>
jj edit @-                     # edit parent
jj edit main                   # edit main bookmark

# Navigate relatively
jj next                        # move to child commit
jj next --edit                 # move and edit
jj prev                        # move to parent commit
jj prev --edit                 # move and edit parent

Editing History

Squash: Combine Commits

# Squash current commit into its parent
jj squash
jj squash -m "combined message"

# Squash specific commit into its parent
jj squash -r <rev>

# Squash into a specific destination (not just parent)
jj squash --into <dest>

# Interactively select which changes to squash
jj squash -i

Split: Divide a Commit

# Interactively split current commit into multiple
jj split

# Split specific commit
jj split -r <rev>

# Split by file paths
jj split <file1> <file2>       # first commit gets these files

Edit: Modify Historical Commits

# Move working copy to an old commit to edit it
jj edit <rev>

# Make your changes (they apply directly to that commit)
# All descendant commits automatically rebase

# Return to the tip when done
jj new <tip-rev>
# or
jj edit <original-working-copy>

Rebase: Move Commits

# Rebase current commit to new destination
jj rebase -d <destination>
jj rebase -d main@origin       # rebase onto latest main

# Rebase specific revision
jj rebase -r <rev> -d <dest>

# Rebase revision and all descendants
jj rebase -s <source> -d <dest>

# Rebase entire branch (all ancestors up to destination)
jj rebase -b <rev> -d <dest>

Other History Operations

# Abandon (delete) a commit
jj abandon                     # current commit
jj abandon <rev>               # specific commit

# Duplicate a commit
jj duplicate <rev>

# Create a commit that reverses changes
jj backout -r <rev>

# Restore files from another revision
jj restore --from <rev>        # restore all files
jj restore --from <rev> <path> # restore specific path

Working with Bookmarks

Bookmarks are jj's equivalent of git branches. They're pointers to commits
that automatically follow when commits are rewritten.

# List all bookmarks
jj bookmark list
jj bookmark list --all         # include remote bookmarks

# Create bookmark at current commit
jj bookmark create <name>
jj bookmark create feature-x

# Create bookmark at specific revision
jj bookmark create <name> -r <rev>

# Move bookmark to current commit
jj bookmark set <name>
jj bookmark set <name> -r <rev>

# Delete bookmark
jj bookmark delete <name>

# Rename bookmark
jj bookmark rename <old> <new>

# Track remote bookmark (for pulling updates)
jj bookmark track <name>@<remote>
jj bookmark track main@origin

# Untrack remote bookmark
jj bookmark untrack <name>@<remote>

Working with Tags

Tags are release/version markers. In Git-backed repositories, jj can read
lightweight and annotated Git tags, but jj tag set creates lightweight tags
only. Use Git when you need annotated or signed release tags.

Tagged commits are immutable by default because tags() is included in
builtin_immutable_heads(). If a rebase, squash, edit, or abandon fails near a
release commit, check whether a tag is anchoring that history before using
--ignore-immutable.

# List tags
jj tag list
jj tag list v1.*                 # glob/string-pattern match
jj tag list --all-remotes        # include remote tags
jj tag list --conflicted         # show conflicted tags only

# Create lightweight tag at current commit
jj tag set v1.2.3

# Create lightweight tag at specific revision
jj tag set v1.2.3 -r <rev>

# Move an existing tag intentionally
jj tag set v1.2.3 -r <rev> --allow-move

# Delete local tag (does not abandon the commit)
jj tag delete v1.2.3

# Find tags containing a revision, like git tag --contains
jj tag list -r '<rev>::'

# Find tags merged into a revision, like git tag --merged
jj tag list -r '::<rev>'

Tag Git Interop

jj git push is bookmark-oriented and has no --tags equivalent. In colocated
workspaces, jj usually exports refs to the shared .git repo automatically; in
non-colocated workspaces, run jj git export before using Git to publish tags.

# Create an annotated release tag with Git
git tag -a v1.2.3 -m "v1.2.3" <rev>

# Publish a single tag
git push origin v1.2.3

# Publish all local tags
git push origin --tags

# Delete a remote tag
git push origin :refs/tags/v1.2.3

Tag Name Resolution

Revset symbols resolve tag names before bookmark names. If a tag and bookmark
share the same name, the tag wins. For scripts or ambiguous names, prefer an
explicit revset function such as commit_id(<prefix>), bookmarks(<pattern>),
or tags(<pattern>).

Git Interop (Colocated Mode)

In colocated mode, jj and git share the same .git directory. This is the
recommended setup for existing git repositories.

Setup

# Initialize jj in existing git repo
jj git init --colocate

# Or clone with colocate
jj git clone --colocate <url>

Fetching and Pushing

# Fetch from all remotes
jj git fetch

# Fetch from specific remote
jj git fetch --remote origin

# Push bookmark to remote
jj git push --bookmark <name>
jj git push -b <name>          # short form

# Push all bookmarks
jj git push --all

# Push and create bookmark in one step
jj bookmark create my-feature && jj git push -b my-feature

Remote Bookmark References

# Reference remote bookmarks in commands
jj log -r main@origin          # show remote main
jj new main@origin             # new commit based on remote main
jj rebase -d main@origin       # rebase onto remote main

Importing Git State

# Import refs from git (usually automatic)
jj git import

# Export jj state to git
jj git export

Common Workflows

Starting New Work

# Fetch latest and start from main
jj git fetch
jj new main@origin -m "feat: add user dashboard"

# Create a bookmark for the feature
jj bookmark create feat/user-dashboard

Daily Development Flow

# Check status
jj st

# Make changes (automatically tracked)
# Edit files...

# Update commit message when ready
jj describe -m "feat: implement dashboard layout"

# View what you've done
jj diff
jj log

# Start next piece of work
jj new -m "feat: add dashboard widgets"

PR Workflow

# 1. Start feature from main
jj git fetch
jj new main@origin -m "feat: new feature"
jj bookmark create feat/my-feature

# 2. Work on feature (changes auto-tracked)
# ... make changes ...
jj describe -m "feat: complete implementation"

# 3. Before pushing, rebase onto latest main
jj git fetch
jj rebase -d main@origin

# 4. Push to remote
jj git push -b feat/my-feature

# 5. Create PR via GitHub/GitLab UI or CLI

Updating PR After Review

# Fetch to see if main has moved
jj git fetch

# If you need to edit a specific commit in your stack:
jj edit <commit-to-fix>
# Make changes...
# Descendants auto-rebase

# Return to working on tip
jj new <tip-of-your-branch>

# Or if adding changes to current commit, just edit files

# Rebase onto latest main
jj rebase -d main@origin

# Force push (bookmark moved)
jj git push -b feat/my-feature

Cleaning Up Before Merge

# Squash fixup commits
jj squash -r <fixup-commit>

# Or interactively squash
jj squash -i

# Ensure rebased on latest main
jj git fetch
jj rebase -d main@origin

# Final push
jj git push -b feat/my-feature

Working on Multiple Things

# You're working on feature A
jj describe -m "feat: feature A in progress"

# Need to quickly work on something else
jj new main@origin -m "fix: urgent hotfix"
jj bookmark create fix/urgent

# Work on hotfix...
jj describe -m "fix: resolve critical bug"
jj git push -b fix/urgent

# Return to feature A
jj edit <feature-a-commit>
# or
jj new <feature-a-commit>

Conflict Resolution

How jj Handles Conflicts

Unlike git, jj doesn't block operations when conflicts
occur. Conflicts are stored as part of the commit and can be resolved
later.

# Check for conflicted commits
jj log -r 'conflicts()'

# See conflict details
jj st                          # shows conflict markers
jj diff                        # shows conflicted content

Resolving Conflicts

# Option 1: Edit files directly
# Open conflicted files, resolve markers, save

# Option 2: Use resolve command with merge tool
jj resolve
jj resolve <path>              # specific file

# After resolving, commit is automatically updated
jj st                          # verify resolved

Conflict Markers

jj uses standard conflict markers in files:

<<<<<<< Conflict 1 of 1
%%%%%%% Changes from base to side #1
-old line
+new line from side 1
+++++++ Contents of side #2
new line from side 2
>>>>>>>

Aborting a Conflicted Rebase

# Check operation log
jj op log

# Undo the rebase that caused conflicts
jj op undo

Revsets

Revsets are expressions for selecting commits. They're used with -r
flag in many commands.

Basic Revsets

| Revset | Description |
|----------------|-----------------------------|
| @ | Working copy commit |
| @- | Parent of working copy |
| @-- | Grandparent of working copy |
| <rev>- | Parent of revision |
| root() | The root commit |
| heads(all()) | All head commits |
| bookmarks() | All commits with bookmarks |
| tags() | All local tag targets |
| main | Commit at bookmark "main" |
| main@origin | Remote bookmark |

Ancestry Operators

| Revset | Description |
|------------------|----------------------------------|
| ::<rev> | Ancestors of rev (inclusive) |
| <rev>:: | Descendants of rev (inclusive) |
| <rev1>::<rev2> | Commits between rev1 and rev2 |
| ::@ | All ancestors of working copy |
| @:: | Working copy and all descendants |
| | |

Set Operations

| Revset | Description |
|--------------------|-------------------------------

Related Skills

Get the best new skills
in your inbox

Weekly roundup of top Claude Code skills, MCP servers, and AI coding tips.