Loading...
Loading...
Use this skill for ANY task involving jj or jujutsu version control. ALWAYS trigger when the user mentions jj, jujutsu, revsets, change IDs, bookmarks, or oplog. Also trigger when the user wants to squash, split, or reorder commits in a stack, write a revset query, absorb fixup changes, undo or restore a previous operation, resolve conflicts after rebasing, recover from force-pushes, rewrite protected/immutable commits, view change evolution (evolog), or try parallel approaches. Trigger even if "jj" is not explicitly said — "changes" instead of "commits", "stack" instead of "branch", "absorb", "squash into the right commit", "undo my last operation", "conflict after rebase", or "compare approaches in parallel" are strong jj signals. This skill contains critical non-obvious rules (like always using -m flags) that prevent broken workflows.
npx skill4agent add trevors/dot-claude using-jjjj undojj op restoreabsorb-m# WRONG - opens editor, blocks AI
jj new
jj describe
jj commit
jj squash
# CORRECT - non-interactive
jj new -m "message"
jj describe -m "message"
jj commit -m "message"
jj squash -m "message"jj splitjj split -ijj squash -ijj diffedit@git add@@-@--kpqxywona1b2c3d4xyz/n<change-id>/nxyz/0xyzxyz/1xyz/2jj restore --from xyz/1 --to xyz # Revert xyz to its previous contents
jj diff --from xyz/1 --to xyz # See what changed between versions--continuejj logjj describe -m "feat: what I'm building" # State intent on current change
jj new -m "wip" # New empty change on top
# ... make changes ...
jj squash -m "feat: done" # Squash into parent# ... make changes ...
jj commit -m "feat: what I did" # Describe + create new change in one step
# ... keep working ...jj commitjj describe -m "..." && jj newjj edit <change-id> # Switch working copy to that change
# ... make your fix ...
jj new -m "back to work" # Return to tip (descendants auto-rebased)jj new main -m "approach A" # Branch from main
jj new main -m "approach B" # Another branch from main (not from A)
jj diff --from <A-id> --to <B-id> # Compare approaches
jj edit <winner-id> # Continue with the winner
jj abandon <loser-id> # Discard the loser@jj absorb# You're at the top of a 3-commit stack, fixing bugs across all of them
jj absorb # Each fix goes to the right commit automaticallyjj absorbjj squashjj bookmark set master -r @- # Point bookmark at your commit (not empty @)
jj git push# Create and push
jj bookmark create feature-x -r @-
jj git push
# Update after more work
jj bookmark set feature-x -r @-
jj git pushjj new feature-x- -m "address review feedback"
# ... make changes ...
jj squash -m "feat: updated per review"
jj bookmark set feature-x -r @-
jj git push@@-| Expression | Meaning |
|---|---|
| Current working copy |
| Parent |
| Grandparent |
| Children of x |
| All descendants of x |
| All ancestors of x |
| The trunk/main commit |
| All bookmarked commits |
| Empty commits |
| Divergent changes |
| Remote tags |
| Commits with matching diff |
| Filter by description |
| Filter by author |
jj log -r 'trunk()..@' # Everything between main and here
jj log -r '::@ & ~::trunk()' # My branch only
jj log -r 'author("trevor")' # My commitsjj git fetch # Pull from remote
jj rebase -d master@origin # Rebase onto updated mainimmutable_heads()# Disable protection (quote the key — parentheses are invalid TOML bare keys)
jj config set --repo 'revset-aliases."immutable_heads()"' 'none()'
# Do your rewrite
jj squash -m "updated message"
# ALWAYS restore protection immediately after
jj config set --repo 'revset-aliases."immutable_heads()"' 'builtin_immutable_heads() | remote_bookmarks()'NAMEimmutable_heads()'revset-aliases."immutable_heads()"'jj op log # See all operations
jj undo # Undo last operation
jj op restore <id> # Jump to any past state
jj evolog # See how current change evolved
jj evolog -r <change-id> # See how any change evolved~/.config/jj/config.toml[remotes.origin]
auto-track-bookmarks = "*"
[revset-aliases]
# Prevent rewriting pushed commits
'immutable_heads()' = 'builtin_immutable_heads() | remote_bookmarks()'
# Shorthand for trunk
'trunk()' = 'master@origin'rm -rf .jj # Delete jj state, keep git unchanged