| name | jujutsu |
| description | Manages version control with Jujutsu (jj), including rebasing, conflict resolution, and Git interop. Use when tracking changes, navigating history, squashing/splitting commits, or pushing to Git remotes. |
Jujutsu
Git-compatible VCS for concurrent work and easier history editing.
⚠️ Not Git! Jujutsu syntax differs:
- Parent:
@- not @~1 or @^
- Grandparent:
@-- not @~2
- Child:
@+ not @~-1
- Use
jj log, not jj changes
Key Commands
| Command | Description |
|---|
jj st | Show working copy status |
jj log | Show change log |
jj diff | Show working copy changes |
jj new | Create new change |
jj desc | Edit change description |
jj squash | Move changes to parent |
jj split | Split current change |
jj rebase -s src -d dest | Rebase changes |
jj absorb | Move changes into mutable stack |
jj bisect | Find bad revision by bisection |
jj fix | Update files with formatter fixes |
jj sign | Cryptographically sign revision |
jj metaedit | Edit metadata without changing content |
Project Setup
jj git init
jj git init --colocate
Basic Workflow
jj new
jj desc -m "feat: add feature"
jj log
jj edit change-id
jj new --before @
jj edit @-
Time Travel
jj edit change-id
jj next --edit
jj edit @-
jj new --before @ -m msg
Merging & Rebasing
jj new x yz -m msg
jj rebase -s src -d dest
jj abandon
Conflicts
jj resolve
Revset Syntax
Parent/child operators:
| Syntax | Meaning | Example |
|---|
@- | Parent of @ | jj diff -r @- |
@-- | Grandparent | jj log -r @-- |
x- | Parent of x | jj diff -r abc123- |
@+ | Child of @ | jj log -r @+ |
x::y | x to y inclusive | jj log -r main::@ |
x..y | x to y exclusive | jj log -r main..@ |
x|y | Union (or) | jj log -r 'a | b' |
⚠️ Common mistakes:
- ❌
@~1 → ✅ @-
- ❌
@^ → ✅ @-
- ❌
@~-1 → ✅ @+
- ❌
jj changes → ✅ jj log or jj diff
- ❌
a,b,c → ✅ a | b | c
Functions:
jj log -r 'heads(all())'
jj log -r 'remote_bookmarks()..'
jj log -r 'author(name)'
jj log -r 'description(regex)'
jj log -r 'mine()'
jj log -r 'committer_date(after:"7 days ago")'
jj log -r 'mine() & committer_date(after:"yesterday")'
Templates
jj log -T 'commit_id ++ "\n" ++ description'
Git Interop
jj bookmark create main -r @
jj git push --bookmark main
jj git fetch
jj bookmark track main@origin
Advanced Commands
jj absorb
jj bisect start
jj bisect good
jj bisect bad
jj fix
jj sign -r @
jj metaedit -r @ -m "new message"
Tips
- No staging; changes apply immediately
- Use conventional commits:
type(scope): desc
jj undo reverts operations
jj op log shows operation history
- Bookmarks are like branches
jj absorb is strong tool for fixing stacks