| name | jj |
| description | Use jj (Jujutsu) for local version control instead of git. Activate when: the repo has a .jj/ directory, the user or project config mentions jj, the user says 'use jj', or any version control operation is needed in a jj-managed repo. Also use this skill when the user asks to commit, branch, stash, rebase, or perform any git-like operation in a repo that uses jj. If unsure whether the repo uses jj, check for a .jj/ directory. |
jj (Jujutsu) — Version Control for Agent Workflows
Core Mental Model
- Working copy is always a commit (
@). Every file edit auto-amends it. No staging area, no git add.
- Change ID (e.g.
kntqzsqt) is stable across rewrites. Use it as a reference — short prefixes work.
- No active branch. Work directly with commits. Bookmarks (= git branches) are only needed for pushing.
- Bookmarks follow rebases. Unlike git branches, they move with commits automatically.
Detecting a jj Repo
test -d .jj && echo "jj repo"
When both .jj/ and .git/ exist (colocated), always use jj commands.
Essential Commands
jj st
jj log
jj diff
jj diff -r <rev>
jj describe -m "msg"
jj new
jj new -m "msg"
jj new -A <rev>
jj edit <rev>
jj squash
jj squash --from <rev> --into <rev>
jj split -r <rev> <file>...
jj abandon <rev>
jj rebase -d <dest>
jj rebase -r <rev> -d <dest>
jj rebase -s <rev> -d <dest>
jj resolve --list
jj resolve --tool=:ours
jj resolve --tool=:theirs
jj bookmark create <name>
jj bookmark set <name>
jj bookmark advance
jj bookmark track main@origin
jj git fetch
jj git push
jj git push --bookmark <name>
jj git init --colocate
jj undo
jj op log
jj op restore <op-id>
Key Patterns
Start next task: jj new — previous change is preserved, no stash needed.
Edit older commit: jj edit <rev>, make changes, done. All descendants rebase automatically.
Stack of PRs: Create a chain of changes, jj bookmark create pr1/pr2/pr3 at each, push separately. When pr1 needs a fix, jj edit into it — descendants auto-rebase, repush each bookmark.
Undo anything: jj undo. Nothing is ever lost — use jj op log + jj op restore to go further back.
No stash: Just jj new off a different base, do the work, then jj edit back.
Common Mistakes
- Do not use
git add, git commit, git stash, or git checkout in a jj repo.
- Do not create bookmarks for local-only work — they're only needed for remotes.
- Do not worry about losing work —
jj undo / jj op restore recovers everything.