LinuxCommandLibrary

jj-operation

Execute specific operations

TLDR

Show operation log

$ jj [[op|operation]] log
copy

Undo the last operation
$ jj [[op|operation]] undo
copy

Undo a given operation
$ jj [[op|operation]] undo [operation]
copy

Restore the repository to its state at a given operation
$ jj [[op|operation]] restore [operation]
copy

Show changes to the repository in an operation
$ jj [[op|operation]] show [operation]
copy

Show stat, summary and patch of modifications of an operation
$ jj [[op|operation]] show [--stat] [[-s|--summary]] [[-p|--patch]] [operation]
copy

SYNOPSIS

jj operation <SUBCOMMAND> [OPTIONS]

PARAMETERS

log
    Displays a chronological log of all operations that have modified the repository. This log includes details like the operation ID, timestamp, description, and the user who performed it. It's analogous to a detailed reflog but for Jujutsu's internal state.

--limit <COUNT>
    Used with log, limits the number of operations displayed to the specified count.

--from-script
    Used with log, filters the output to show only operations that originated from scripts.

--no-graph
    Used with log, suppresses the visual graph representation in the output.

--reversed
    Used with log, displays operations in reverse chronological order (oldest first).

--json
    Used with log, outputs the operation log in JSON format, useful for scripting and programmatic access.

restore <OPERATION_ID>
    Restores the repository to the state it was in after the specified operation. This acts as a powerful undo mechanism, allowing users to revert to any past point in the repository's history captured in the operation log. The <OPERATION_ID> can be a full or partial ID from the log command.

obliterate <OPERATION_ID>...
    Permanently deletes one or more operations from the repository's history. This is a destructive and irreversible command. It should be used with caution, as it removes the ability to restore to the obliterated operations. It can also reclaim disk space by removing associated objects.

--delete-git-refs
    Used with obliterate, also deletes any Git references that were created by the obliterated operations, ensuring a cleaner removal if the repository interacts with Git.

DESCRIPTION

The jj operation command group is a fundamental part of the Jujutsu (jj) version control system, allowing users to inspect, restore, and manage the history of changes made to the repository's state. Unlike traditional Git's reflog, Jujutsu's operation log is a persistent, detailed record of every command that modified the repository, including commits, rebases, merges, and pushes. This robust mechanism provides powerful undo capabilities, enabling users to "time travel" to any past state of the repository. It's crucial for understanding the history of modifications and for recovering from unintended changes, making it a cornerstone for Jujutsu's user experience and its non-destructive approach to version control until an operation is explicitly obliterated.

CAVEATS

The jj operation commands are specific to the Jujutsu (jj) version control system and are not standalone Linux utilities.
The obliterate subcommand is permanent and destructive; use it with extreme caution as data cannot be recovered after obliteration.
Jujutsu is under active development, and command behaviors or options may evolve.

OPERATION LOG PURPOSE

Unlike Git's reflog, which can expire, Jujutsu's operation log is designed to be a permanent, complete audit trail of every command that altered the repository's state. This allows for unparalleled flexibility in reverting changes and exploring past repository configurations without loss of data, until explicitly obliterated.

NON-DESTRUCTIVE BY DEFAULT

A core tenet of Jujutsu is that operations like rebasing or amending are non-destructive. This means the old state is preserved in the operation log. The jj operation commands facilitate this by allowing users to return to any previous state, providing a robust 'undo' functionality that typical Git workflows lack without manual reflog management.

HISTORY

The concept of an immutable operation log is central to Jujutsu's design philosophy, introduced early in its development (around 2021-2022). It distinguishes Jujutsu from other VCS by providing a comprehensive, persistent history of all repository modifications, making complex rebases and history rewriting operations safer and fully reversible by default. The jj operation subcommands have been a core component since the initial public releases of Jujutsu, evolving slightly with new options and stability improvements.

SEE ALSO

jj(1), git-reflog(1), git-log(1)

Copied to clipboard