jj-next
Move to the next commit
TLDR
Move the working-copy commit to the next child revision
Move the working-copy commit a number of revisions forward
Edit the child revision directly, instead of creating a new working-copy commit
Create a new working-copy commit instead of editing the child revision directly
Jump to the next conflicted child
SYNOPSIS
jj next
PARAMETERS
--help
Displays a help message for the `jj next` command, detailing its usage and available options.
-h
A shorthand alias for the --help option, providing a quick summary of the command's usage.
DESCRIPTION
The `jj next` command is an integral part of the Jujutsu (jj) version control system, designed for intuitive navigation through the commit graph. It allows users to advance the working copy to the "next" unapplied change in the current commit's lineage. This is especially useful in workflows where developers maintain a stack of dependent changes, akin to patch stacks or interactive rebases in other VCS.
Unlike traditional systems that might require explicit branch checkouts or complex rebase commands, `jj next` simplifies moving forward through a series of development steps. It inherently understands the relationship between commits and the working copy, treating the working copy itself as a mutable commit. This command, paired with `jj prev`, provides a powerful and streamlined way to traverse and interact with the commit history, enabling rapid iteration and review of sequential changes without losing context. It's a cornerstone of Jujutsu's user-friendly approach to managing complex histories.
CAVEATS
Requires the Jujutsu (jj) version control system to be installed and configured.
The command operates relative to the current working copy's parent change. If there are multiple child changes (e.g., diverging branches from the current commit), the specific "next" change chosen by `jj next` is determined by Jujutsu's internal logic, which is typically deterministic but might not always align with the user's immediate expectation without a clear understanding of the commit graph.
If the current working copy is already at a "head" (a commit with no further children that are not already part of the working copy), `jj next` will indicate there is no next change or simply do nothing.
WORKING COPY AS A MUTABLE COMMIT
In Jujutsu, the working copy is not just a collection of files but is treated as a distinct, mutable commit. The `jj next` command effectively moves this working copy commit to a child commit in the graph, making that child commit the new parent of the working copy. This abstraction simplifies many operations that are complex in other VCS and is a core differentiator of Jujutsu.
STACKING CHANGES WORKFLOW
`jj next` is crucial for workflows involving 'stacked changes' or 'patch stacks'. Developers can build a series of dependent commits, and `jj next` allows them to easily move forward through this stack, applying each subsequent change to the working copy. This facilitates iterative development, code review, and refactoring by keeping related changes isolated but easily navigable, enhancing productivity and code quality.
HISTORY
The Jujutsu (jj) VCS, which includes the `jj next` command, emerged around 2020 as a modern alternative to traditional systems like Git. Developed by Martin von Zweigbergk, its design philosophy centers on a simpler, more powerful model for version control, particularly for managing complex histories and stacked changes. The `jj next` and `jj prev` commands are fundamental to Jujutsu's unique interactive workflow, treating the working copy as a mutable commit and enabling seamless navigation through sequential changes. This contrasts sharply with Git's model, where similar operations often require more explicit branch management or interactive rebase commands. These commands are key contributors to Jujutsu's goal of making advanced VCS operations more intuitive and less error-prone.


