jj Cheatsheet
Simplified change handling - working copy is a commit, empty root commit, no “workspace” and index
And it adds several innovative, useful features of its own:
-
Working-copy-as-a-commit: Changes to files are recorded automatically as normal commits, and amended on every subsequent change. This “snapshot” design simplifies the user-facing data model (commits are the only visible object), simplifies internal algorithms, and completely subsumes features like Git’s stashes or the index/staging-area.
-
Operation log & undo: Jujutsu records every operation that is performed on the repository, from commits, to pulls, to pushes. This makes debugging problems like “what just happened?” or “how did I end up here?” easier, especially when you’re helping your coworker answer those questions about their repository! And because everything is recorded, you can undo that mistake you just made with ease. Version control has finally entered the 1960s!
-
Automatic rebase and conflict resolution: When you modify a commit, every descendent is automatically rebased on top of the freshly-modified one. This makes “patch-based” workflows a breeze. If you resolve a conflict in a commit, the resolution of that conflict is also propagated through descendants as well. In effect, this is a completely transparent version of git rebase –update-refs combined with git rerere, supported by design.
-
Safe, concurrent replication: Jujutsu is instead designed to be safe under concurrent scenarios; simply using rsync or Dropbox and then using that resulting repository should never result in a repository in a corrupt state. The worst that should happen is that it will expose conflicts between the local and remote state, leaving you to resolve them.
-
LICENSE Apache License 2.0
jj git clone <url>
jj st
jj status
jj describe
jj new
jj new --message
jj squash
jj edit <commit>
jj log
jj log -r ::
jj log -r 'all()'
jj log -r <revset>
jj log --revisions <revset>
@
root()
bookmarks()
|, &, ~
jj log -r '@ | root() | bookmarks()'
parents (foo-), children (foo+), ancestors (::foo), descendants (foo::), DAG range (foo::bar), range foo..bar
jj rebase --source puqltutt --destination nuvyytnq
-s -d
resolve conflicts through new commit (jj new) and jj resolve
or edit the conflict markers in the files directly
inspect the result with `jj diff`
`jj squash` to move the resolution into the conflicted commit
operation log
jj operation
jj op
jj op log
jj undo
jj op undo
jj log --at-op=367400773f87
jj squash --interactive
jj squash -i
moves only part of the changes into its parent
jj diffedit
edit the changes in a commit without checking it out
jj diff -r @-
jj split
jj commit -m 'feat(bar): add support for bar'
jj git push -c @-
jj bookmark create bar -r @- # `bar` now contains the previous two commits.
# Push the bookmark to GitHub (pushes only `bar`)
$ jj git push --allow-new
jj git fetch
jj rebase -d $main_bookmark
A "co-located" Jujutsu repo is a hybrid Jujutsu/Git repo.
In a co-located repository, every jj command will automatically synchronize Jujutsu's view of the repo with Git's view. For example, jj commit updates the HEAD of the Git repository, enabling an incremental migration.
jj git init --colocate
jj git clone --colocate
jj git import
jj util gc
echo '/*' > .jj/.gitignore
mv .jj/repo/store/git .git
echo -n '../../../.git' > .jj/repo/store/git_target
git config --unset core.bare
jj new && jj undo
refs/jj/
.jj/store/extra/
Commits with conflicts cannot be represented in Git
jjconflict-base-*/ and .jjconflict-side-*/
jj abandon to get back to the state with the unresolved conflicts
Jujutsu repository
In a Jujutsu repository, the workflow is simplified. If there's no need for explicitly named bookmarks, you can just generate one for a change. As Jujutsu is able to create a bookmark for a revision.
jj commit
jj git push --change mw
jj bookmark move your-feature --to @-
jj bookmark move your-feature --to @
jj git clone imports the default remote bookmark (which is usually main or master), but jj git fetch doesn't import new remote bookmarks to local bookmarks
jj new <bookmark>@<remote>
https://jj-vcs.github.io/jj/latest/github/#useful-revsets
jj git clone --remote upstream https://github.com/upstream-org/repo
cd repo
jj git remote add origin git@github.com:your-org/your-repo-fork
.jj/repo/config.toml:
[git]
fetch = "upstream"
push = "origin"