Check out the Jujutsu Tutorial for an explanation of how it works. The guide below is for useful commands.
Guide to Jujutsu
Jujutsu (jj) is a version control system that’s more intuitive and efficient than Git for local development. It is designed to work seamlessly with Git as a backend, allowing you to use jj for your personal workflow while collaborating with others via Git and GitHub. This makes it ideal for multi-device sync or contributing to team projects without forcing everyone to switch from Git.
This guide goes over the most important commands, see the full manual here
Setup jj CLI
jj config set --user user.name "Your Name"jj config set --user user.email "your.email@example.com"
Git integration setup
- Ensure you have
gitandghset up as described in the Git Guide jjworks best when it can find your git credentials.
Important commands
Most jj commands have shorthands (e.g., jj b s for jj bookmark set). You can shorten any command as long as it’s unambiguous.
Cloning a repository
jj git clone https://github.com/owner-name/existing-repo.gitjj git clone owner-name/existing-repo(if using the git backend)
Creating a repository
jj init --gitto create a new jj repo with a git backendjj git init --colocateto turn an existing git repo into a jj repo (keeping the.gitfolder)
Managing versions
jj logto see the version tree (jj’s log is much more readable by default)jj statusorjj stto see current changes
The jj Workflow
Unlike Git, jj doesn’t have a staging area. Your working copy is always an “open” commit.
- Change ID (usually 4-8 letters like
qpvz) is stable. It stays the same even if you rebase or edit the commit. Use this for most commands. -
Commit ID (hex like
a1b2) changes whenever you modify a commit. jj describe -m "commit message"to set the message of the current working commit.jj newto “finish” the current commit and start a new one on top of it.jj edit <change-id>to go back and edit a previous commit.jj squashto move changes from the current commit into its parent.jj abandonto discard the current change.jj undoto undo the last command you ran.
Handling Conflicts
In jj, conflicts are “first-class citizens.” They don’t stop you from working or committing.
- When a conflict occurs,
jjwill show it injj logandjj status. - You can still run
jj new,jj rebase, etc., even with conflicts. - To resolve: Open the conflicted file, fix the markers, and save.
jjwill detect the fix automatically.
Better Editor Compatibility
By default, jj uses its own conflict format. To use Git-style markers (which most editors like VS Code highlight correctly), run:
jj config set --user ui.conflict-marker-style "git"
Nonlinear versions - Bookmarks (Branches)
In jj, branches are called bookmarks. They don’t move automatically; you point them to where you want them.
jj bookmark listto see all bookmarks.jj bookmark set feature-nameto point a bookmark to the current commit.jj bookmark delete feature-nameto remove a bookmark.
Working with remotes & GitHub
jj git fetchto fetch from the remote.jj rebase -d main@originto move your current work on top of the remote main.jj bookmark track bookmark-name --remote originto track a remote bookmark locally.jj git push --bookmark feature-nameto push a specific bookmark to GitHub.- Subsequent
jj git pushwill update the bookmark on the remote if it has moved locally.
- Subsequent
Managing Pull Requests
- Use
gh pr createas usual.jjwill often print the PR creation link after a push. - To update a PR, just edit your commits and
jj git push.