Jujutsu (jj) is a Git-compatible version control system that eliminates common Git pain points while maintaining full compatibility with Git repositories.
Core Concepts
Change IDs vs Commit IDs
JJ uses change IDs to track logical changes, separate from commit IDs:
|
|
- Change ID:
qpvuntsm- stable across amendments - Commit ID:
d4f2a1b2- changes with every modification
This allows amending commits without losing track of the logical change.
No Staging Area
JJ eliminates Git’s staging area. Every edit is automatically part of the working commit:
|
|
No git add required. Changes are immediately visible in jj log.
Conflicts as First-Class Objects
JJ treats conflicts as committable states, not errors:
|
|
Conflicts can be committed, rebased, and resolved later. The conflict state is preserved across operations.
Automatic Working Copy Commits
JJ automatically commits working changes to track history:
|
|
The @ symbol represents the current working copy commit.
Why JJ Over Git
Simplified Mental Model
Git workflow:
- Edit files
- Stage changes (
git add) - Commit staged changes
- Amend requires
--amendflag - Force push with
--force-with-lease
JJ workflow:
- Edit files
- Describe changes (
jj describe) - Create new change (
jj new)
Safe Rewriting
JJ makes rewriting history safe:
|
|
No detached HEAD states. No lost work.
Branchless Workflow
JJ doesn’t require named branches for development:
|
|
Named branches (bookmarks) are optional, used only when needed for remotes.
Git Compatibility
JJ is a Git frontend. All operations work on Git repositories:
|
|
Git and JJ can be used interchangeably on the same repository.
Key Operations
| Task | Git | JJ |
|---|---|---|
| View status | git status |
jj st |
| Commit message | git commit -m |
jj describe -m |
| Amend commit | git commit --amend |
jj describe |
| View history | git log |
jj log |
| Create branch | git checkout -b |
jj new |
| Rebase | git rebase -i |
jj rebase |
| Squash commits | git rebase -i (interactive) |
jj squash |
When to Use JJ
Good fit:
- Teams comfortable with advanced Git workflows
- Projects requiring frequent history rewriting
- Developers frustrated with Git’s staging area
- Stacked PR workflows (Gerrit-style)
Consider staying with Git:
- Teams with basic Git workflows (commit/push only)
- Heavy reliance on Git-specific tools
- Team unfamiliar with advanced VCS concepts
Resources
- Official documentation: https://martinvonz.github.io/jj/
- GitHub repository: https://github.com/martinvonz/jj
- Comparison with other VCS: https://github.com/martinvonz/jj/blob/main/docs/comparison.md