| name | jujutsu |
| description | Jujutsu (jj) version control commands and workflows. Use when performing version control operations, committing changes, managing branches/bookmarks, or syncing with remotes. Always use jj instead of git. |
Jujutsu (jj) Version Control
Use jj instead of git for all version control operations.
Key Differences from Git
- jj automatically commits changes (working copy is always a commit)
- Use
jj describe to update commit messages instead of git commit --amend
- No staging area - all changes are part of working copy commit
jj new creates a new commit on top, making previous commit immutable
Non-Interactive Usage (Required)
Always use non-interactive forms - interactive commands open editors/diff tools.
Commands That Require -m Flag
jj describe -m "message"
jj commit -m "message"
jj describe
jj commit
Commands to Avoid
| Blocked Command | Alternative |
|---|
jj diffedit | jj restore or jj squash |
jj split (no filesets) | jj split -m "msg" <files> |
jj resolve | jj resolve --list then edit conflict markers |
jj squash -i | jj squash (non-interactive) |
jj restore -i | jj restore <files> |
Any command with --tool | Use non-interactive alternatives |
Splitting Commits
jj split -m "first part" src/file1.ts src/file2.ts
jj split
jj split -m "message"
Resolving Conflicts
jj resolve --list
jj squash
Common Commands
View Status and Changes
jj status
jj log
jj diff
jj show
Making Changes
jj describe -m "message"
jj new
jj commit -m "message"
jj squash
Working with Bookmarks/Branches
jj bookmark create name
jj bookmark set name
jj bookmark list
jj bookmark delete name
Navigating History
jj edit <commit>
jj next
jj prev
Syncing with Remote
jj git fetch
jj git push
Undoing Changes
jj undo
jj restore <files>
Custom Aliases
These are configured in ~/.config/jj/config.toml:
jj overview
jj l
jj tug
jj pull
jj push
jj sync
jj c
jj ci
jj e
jj s
jj parents
jj merge <bookmark>
Workspaces
Workspaces allow multiple working copies backed by a single .jj repo. Each workspace can have a different commit checked out.
Commands
jj workspace add <path> --name <name>
jj workspace add ../feature-x --name feature-x
jj workspace add ../experiment --revision main
jj workspace list
jj workspace root
jj workspace forget <name>
rm -rf <path>
jj workspace update-stale
Switching Workspaces
There's no jj workspace switch command - just cd into the workspace directory:
cd ../feature-x
jj log
Critical Gotcha: Untracked Files
Workspaces only share version-controlled files. Files in .gitignore are NOT automatically present:
.env files
node_modules/
- Build artifacts (
dist/, build/, .next/)
- IDE settings (
.idea/, .vscode/ if ignored)
You must manually copy or symlink these to new workspaces:
cd ../new-workspace
cp ../main/.env .env
ln -s ../main/node_modules node_modules
Use Cases
- Run tests while developing - One workspace runs long tests, another for active development
- Parallel features - Work on multiple features without stashing
- Quick experiments - Throwaway workspace for "what if" scenarios
Rewriting History (Squashing Related Commits)
When commits contain intermediate refactors, fixes, or iterations that should be consolidated:
Review Recent History First
jj log --limit 15
jj log -r "..@"
Squash Commits Together
jj squash
jj squash --from <source-rev> --into <target-rev>
jj squash --from <oldest>::<newest> --into <target>
Edit Any Commit in History
jj describe -r <rev> -m "new message"
jj edit <rev>
jj new
Workflow: Clean Up Feature Branch
When you have intermediate commits like refactors, fixes, iterations:
jj log --limit 10
jj squash --from <refactor-rev> --into <feature-rev>
jj squash --from <fix-rev> --into <feature-rev>
jj describe -r <feature-rev> -m "feat: complete feature with cleanup"
Example: Consolidate Iterative Work
If you have:
abc123: feat: implement feature
def456: refactor: clean up feature
ghi789: fix: edge case in feature
Squash them:
jj squash --from ghi789 --into abc123
jj squash --from def456 --into abc123
jj describe -r abc123 -m "feat: implement feature (cleaned up)"
Typical Workflow
jj new
jj describe -m "feat: add feature"
jj overview
jj push
jj sync