LinuxCommandLibrary

jj-new

Create new commit

TLDR

Create a new empty change on top of current revision

$ jj new
copy

Create a new empty change on top of specific revision
$ jj new [revision]
copy

Create a new merge change on top of multiple revisions
$ jj new [revset1 revset2 ...]
copy

Create a new empty change before and after specified revisions
$ jj new [[-B|--insert-before]] [revsets] [[-A|--insert-after]] [revsets]
copy

SYNOPSIS

jj [GLOBAL_OPTIONS] <SUBCOMMAND> [SUBCOMMAND_OPTIONS] [ARGS]

PARAMETERS

init
    Initializes a new jj repository in the current directory.

log
    Displays the commit history, often with more detail and context than Git's log.

diff
    Shows the difference between the working copy and the current commit, or between specified commits.

commit
    Creates a new commit, often with options for specifying what to include or exclude.

branch
    Manages branches, allowing creation, deletion, and tracking of branches.

rebase
    Rebases changesets onto a new parent, a core operation for history rewriting.

squash
    Combines multiple changesets into a single one.

undo
    Reverts the last operation, providing a powerful safety net.

DESCRIPTION

Jujutsu (jj), often conceptually referred to as "jj-new" due to its modern approach, is an experimental and Git-compatible distributed version control system. It's designed to simplify complexities and common pain points found in traditional Git workflows. jj offers a more intuitive mental model for managing changes, particularly around history rewriting, diffing, and committing. Unlike Git, it treats history as inherently mutable and operates on a concept of "changesets" rather than strict commits, making operations like amending, squashing, and rebasing feel more natural and less error-prone. While it can interact seamlessly with Git repositories, it provides its own unique command-line interface and internal representation, prioritizing a clean, linear, and easily editable history by default.

CAVEATS

Experimental and Evolving: Jujutsu is still under active development; its command set, behavior, and internal structure may change.
Different Mental Model: While Git-compatible, jj requires users to adopt a slightly different mental model for version control, which can have a learning curve.
Ecosystem Maturity: Its ecosystem (tooling, integrations, community support) is not as mature as Git's.

DESIGN PHILOSOPHY: EDITABLE HISTORY

jj's core design revolves around the idea that history is inherently editable. It treats commits as "changesets" that can be easily modified, reordered, and combined. This approach simplifies workflows like interactive rebase and enables seamless management of uncommitted changes, making version control less daunting for developers.

GIT COMPATIBILITY

While providing its own unique interface and internal logic, jj maintains strong compatibility with Git repositories. Users can clone Git repositories, push and pull changes to/from Git remotes, and even use jj within existing Git workflows, leveraging its strengths where desired without fully abandoning Git.

HISTORY

Jujutsu (jj) was created by Martin Ă…gren, with development starting around 2020. The primary motivation was to build a version control system that simplifies complex Git workflows, particularly those involving history rewriting. It aims to provide a more intuitive and safer experience for operations like amending, rebasing, and squashing commits, which can be cumbersome in Git. Designed from the ground up to support a flexible and easily editable history, jj has gained traction as a promising alternative or companion for developers seeking a streamlined version control experience.

SEE ALSO

git(1), hg(1), darcs(1), pijul(1)

Copied to clipboard