Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

How jj refers to changes

Every jj operation that acts on a specific change takes a -r flag.

-r means “revision”. The value passed to -r is a revset: a small expression that selects one or more changes from the graph.

@ and @-

@ is the current working-copy change:

jj diff -r @

That means “show me the diff for my current working-copy change”.

@- is the parent of @:

jj diff -r @-

That means “show me the diff for the parent of @”.

Ranges

Revsets can describe ranges:

jj log -r 'main..@'

That means “show me the changes reachable from @ that are not in main”.

Why @- matters after committing

After:

jj commit -m "feat: add token validation"

jj creates a new empty @ as the child of the change you just committed. That makes @- the change you just committed.

So this command:

jj diff -r @-

shows the last completed change. That is exactly what I want after committing, resolving conflicts, or letting an agent modify code.

This pattern appears throughout the book. When you see @- in an example, it almost always means “the change I just finished”.