| name | jj |
| description | Expert guidance for using JJ (Jujutsu) version control system. Use when user mentions jj, jujutsu, or needs version control in JJ-managed repositories. Covers commands, revsets, templates, evolog, operations log, and git interop. |
Provide expert guidance for JJ version control operations. Help users understand JJ's mental model (immutable change IDs, auto-snapshots, conflicts don't block) and execute commands correctly.
<quick_start>
jj log -r <revset> [-p]
jj show -r <rev>
jj new [-A] <base>
jj edit <rev>
jj desc -r <rev> -m "text"
jj diff
jj restore <fileset>
jj rebase -s <src> -o <dest>
jj undo
</quick_start>
<success_criteria>
- JJ operation completed without error
- Working copy (@) in expected state
- Revision graph reflects intended structure
- For rebases/splits: no unintended conflicts introduced
</success_criteria>
<core_principles>
- Change IDs (immutable) vs Commit IDs (content-hash, changes on edit)
- Operations log: every operation can be undone (progressive
jj undo, jj redo reverses)
- No staging area: working copy auto-snapshots
- Conflicts don't block: resolve later
- Commits are lightweight: edit freely
- Colocated by default: Git repos have both
.jj and .git (since v0.34)
- Three DSLs:
- revsets: select revisions (a change ID is a valid singleton revset)
- filesets: select files (a filepath is a valid singleton fileset)
- templates: control output format
</core_principles>
<essential_commands>
jj log -r <revset> [-p]
jj log -r <revset> -G
jj show -r <rev>
jj evolog -r <rev> [-p]
jj new [-A] <base>
jj new --no-edit <base>
jj edit <rev>
jj desc -r <rev> -m "text"
jj metaedit -r <rev> -m "text"
jj diff
jj diff -r <rev>
jj file show -r <rev> <fileset>
jj restore <fileset>
jj restore --from <commit-id> <fileset>
jj split -r <rev> <paths> -m "text"
jj absorb
jj rebase -s <src> -o <dest>
jj rebase -r <rev> -o <dest>
jj rebase -s 'a | b | c' -o <dest>
jj file annotate <path>
jj bisect run -- <cmd>
</essential_commands>
<additional_commands>
jj undo
jj redo
jj sign -r <rev>
jj unsign -r <rev>
jj revert -r <rev>
jj tag set <name> -r <rev>
jj tag delete <name>
jj git colocation enable
jj git colocation disable
</additional_commands>
<revset_reference>
@, @-, @--
::@
@::
mine()
conflicted()
visible()
hidden()
description(substring-i:"text")
subject(substring:"text")
signed()
A | B, A & B, A ~ B
change_id(prefix)
parents(x, 2)
exactly(x, 3)
</revset_reference>
<anti_patterns>
Use -r not --revisions:
jj log -r xyz
jj log --revisions xyz
Use `--no-edit` for parallel branches:
```bash
jj new parent -m "A"; jj new -m "B" # B is child of A
jj new --no-edit parent -m "A"; jj new --no-edit parent -m "B" # Both children of parent
```
Quote revsets in shell:
```bash
jj log -r 'description(substring:"[todo]")'
```
Use `-o`/`--onto` instead of deprecated `-d`/`--destination` (v0.36+):
```bash
jj rebase -s xyz -o main # correct
jj rebase -s xyz -d main # deprecated
```
Symbol expressions are stricter (v0.32+). Revset symbols no longer resolve to multiple revisions:
```bash
jj log -r abc # error if 'abc' matches multiple change IDs
jj log -r 'change_id(abc)' # explicit prefix query
jj log -r 'bookmarks(abc)' # for bookmark name patterns
```
Glob patterns are default in filesets (v0.36+):
```bash
jj diff 'src/*.rs' # matches glob pattern by default
jj diff 'cwd:"src/*.rs"' # use cwd: prefix for literal path
```
Don't use glob with `[` brackets in description() - they're character classes:
```bash
jj log -r 'description(glob:"*[task:*]*")' # WRONG - [task:*] is char class
jj log -r 'description(substring:"[task:")' # CORRECT
jj log -r 'tasks()' # BEST - use alias
```
</anti_patterns>
jj op log
jj op restore <op-id>
<reference_guides>
- Run
jj help -k bookmarks - bookmarks, git branches, push/fetch
- Run
jj help -k revsets - revset DSL syntax
- Run
jj help -k filesets - filepath selection DSL
- Run
jj help -k templates - template language
- All subcommands have detailed
--help
references/command-syntax.md - command flag details
references/batch-operations.md - batch transformations
</reference_guides>