LinuxCommandLibrary

jj-next

Move to the next commit

TLDR

Move the working-copy commit to the next child revision

$ jj next
copy

Move the working-copy commit a number of revisions forward
$ jj next [offset]
copy

Edit the child revision directly, instead of creating a new working-copy commit
$ jj next [[-e|--edit]]
copy

Create a new working-copy commit instead of editing the child revision directly
$ jj next [[-n|--no-edit]]
copy

Jump to the next conflicted child
$ jj next --conflict
copy

SYNOPSIS

jj next [<REVISION>] [--dry-run]

PARAMETERS

<REVISION>
    Revision selector to advance from (defaults to working copy @)

--dry-run
    Preview the operation without making changes to the working copy

-r, --revision <REVSET>
    Explicit revset for the starting revision (alternative to positional argument)

DESCRIPTION

The jj next command is part of Jujutsu (jj), a Git-compatible distributed version control system (VCS) optimized for large repositories, complex workflows, and high performance. Unlike traditional tools like Git, jj uses a directed acyclic graph (DAG) for commits, allowing flexible operations on non-linear histories.

jj next advances the working-copy commit (marked as @) to one of its successor commits, typically the immediate child along the main branch. This updates the working tree to reflect the new commit's changes, effectively "checking out" the next state in the project's evolution. It's ideal for sequential review of changes without manual jj goto or branch switching.

If no revision is specified, it defaults to the current working copy. The command identifies successors and selects the most relevant one (e.g., the one on the default tracking branch). It ensures safety by verifying the operation won't lose uncommitted work. This makes jj next a key tool for linear navigation in jj's commit graph, enhancing productivity in review or bisect workflows.

CAVEATS

Requires jj installed; operates on jj's DAG model, not fully compatible with plain Git repos without conversion. May fail if no successors exist or conflicts arise.

EXAMPLES

jj next
Advances to next commit from working copy.

jj next main
Advances from main tip.

jj next --dry-run
Simulate without changes.

HISTORY

Jujutsu (jj) was developed by Martin von Zweigbergk at Google, with first public release in 2022. jj next introduced early to support intuitive linear navigation in its graph-based model, evolving through community contributions on GitHub.

SEE ALSO

jj prev(1), jj goto(1), jj log(1), git checkout(1)

Copied to clipboard