LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

jj-operation-restore

restore a Jujutsu repository to an earlier operation

TLDR

Restore the repo to a specific operation
$ jj operation restore [operation-id]
copy
Inspect that operation first without changing the current state
$ jj --at-op=[operation-id] log
copy
Restore only repo state and local bookmarks (leave remote-tracking bookmarks)
$ jj op restore --what repo [operation-id]
copy
Find an operation ID
$ jj op log
copy
Then drop the discarded recent operations from the log
$ jj op abandon [operation-id]..@-
copy

SYNOPSIS

jj operation restore [options] operation

DESCRIPTION

jj operation restore (alias jj op restore) creates a new operation whose view matches an earlier operation. The working copy, bookmarks, and other recorded repo state go back to how they looked then, which effectively undoes every later operation. Later operations remain in the log until you abandon them.This is time travel for the whole repository, not a commit-level restore. jj restore copies file contents between revisions; jj op restore replaces the current operation's view. jj undo walks back one (or a few) operations at a time; jj op revert applies the inverse of one operation. jj op restore jumps to a chosen snapshot.Because restore records a new operation, you can undo the restore itself with jj undo. To actually delete the skipped recent history, follow with jj op abandon <operation ID>..@-.

PARAMETERS

OPERATION

The operation to restore to. Copy an ID from jj op log. Any unambiguous prefix is enough. Use jj --at-op=id log (or st) to preview the repo at that operation before restoring.
--what WHAT
Experimental. Which portions of the local state to restore (repeatable). Default: `repo` and `remote-tracking`. `repo` is the jj repo state and local bookmarks. `remote-tracking` is remote-tracking bookmarks — omit it if you want to push after the restore without resetting those refs.
--help
Display help information.

INSTALL

sudo pacman -S jujutsu
copy
sudo apk add jujutsu
copy
sudo zypper install jujutsu
copy
brew install jujutsu
copy
nix profile install nixpkgs#jujutsu
copy

CAVEATS

Subcommand of jj. Operation IDs come from jj op log, not from jj log. Restore does not delete later operations; it adds one that points at the older view. --what is experimental. Skipping `remote-tracking` is the usual choice when you still want to push. Preview with --at-op before restoring a large jump.

SEE ALSO

RESOURCES

Copied to clipboard
Kai