| name | working-with-jj |
| description | Jujutsu (jj) version control cheatsheet - viewing history, making commits, diffs, and descriptions |
Working with Jujutsu (jj)
Quick reference for common Jujutsu operations used in development workflows.
Jujutsu is a Git-compatible VCS that eliminates staging and treats your working directory as an actual commit that continuously updates.
Detecting Jujutsu
Check if the project uses jj:
test -d .jj && echo "jj" || echo "not jj"
Key Concepts
@- Your current working copy (like Git's HEAD)@-- Parent of working copy (like Git's HEAD~1)- No staging area - Changes are automatically recorded
- Change IDs - Stable identifiers that survive rebases
- Commit IDs - Traditional hashes compatible with Git
Recommended Workflow
The jj way:
- Make edits to files
- Run
jj newto create a new commit (repeat for every logical change) - After a series of commits, go back and review with
jj log - Add meaningful descriptions with
jj describe <change-id> -m "description" - Squash related commits together with
jj squash
This workflow creates fine-grained history as you work, then lets you organize it meaningfully afterward.
Viewing the Log
Show recent commits:
jj log -r @~10..@
Show full log:
jj log
Show specific commit:
jj show <change-id>
Show log with more detail:
jj log --stat
Viewing Diffs
See current changes:
jj diff
Diff specific commit:
jj diff -r <change-id>
Diff between two commits:
jj diff --from <base> --to <head>
Git-style diff output:
jj diff --git
Show what changed in a commit:
jj show <change-id>
Getting Commit References
Current commit ID:
jj log -r @ -T commit_id --no-graph
Parent commit ID:
jj log -r @- -T commit_id --no-graph
Get change ID:
jj log -r @ -T change_id --no-graph
Revset references:
@- working copy commit@-- parent commit@--- grandparent commitroot()- the root committrunk()- main branch tip
Making Commits
Create new commit (after editing files):
jj new
Create new commit with message:
jj new -m "commit message"
Commit current changes with description:
jj describe -m "commit message"
jj new
Note: Unlike Git, jj automatically tracks file changes. No add command needed!
Setting Descriptions
Set description for current commit:
jj describe -m "new description"
Set description in editor:
jj describe
Set description for specific commit:
jj describe <change-id> -m "description"
Organizing Commits
Squash current commit into parent:
jj squash
Squash specific commit into its parent:
jj squash -r <change-id>
Squash current commit into a specific commit:
jj squash --into <target-change-id>
Move changes from one commit to another:
jj move --from <source> --to <target>
Edit an earlier commit:
jj edit <change-id>
(Make changes, then jj new to continue)
Split a commit into multiple:
jj split <change-id>
Status Information
See current status:
jj status
See bookmark (branch) info:
jj bookmark list
Common Patterns
Get range for code review:
BASE_SHA=$(jj log -r @- -T commit_id --no-graph)
HEAD_SHA=$(jj log -r @ -T commit_id --no-graph)
echo "Reviewing: $BASE_SHA..$HEAD_SHA"
Compare against trunk:
jj diff --from trunk() --to @
See files changed:
jj diff --summary
Git Interoperability
Fetch from Git remote:
jj git fetch
Push to Git remote:
jj git push
Export to colocated Git repo:
jj git export
Workflow Comparison
| Task | Git | Jujutsu |
|---|---|---|
| Make commit | git add . && git commit -m "msg" |
jj describe -m "msg" && jj new |
| See changes | git diff |
jj diff |
| View history | git log |
jj log |
| Get current SHA | git rev-parse HEAD |
jj log -r @ -T commit_id --no-graph |
| Amend commit | git commit --amend |
jj describe (then jj new if done) |
| No staging | (N/A) | Automatic! |
Why Jujutsu?
- No staging area confusion - Edit files, they're tracked
- No detached HEAD - All commits are reachable
- Conflict tracking - Conflicts are first-class objects
- Safe experimentation - Easy to undo anything
- Git compatible - Works with GitHub, GitLab, etc.