jj-operation-restore(1)
π NAME π
Bestie, you've landed on jj-operation-restore(1), straight outta the General Commands Manual section π β and here's the whole vibe in one line: create a new operation that restores the repo to an earlier state β¨
π SYNOPSIS π
jj operation restore [-R|--repository] [--what] [--ignore-working-copy]
[--no-integrate-operation] [--ignore-immutable] [--at-operation]
[--debug] [--color] [--quiet] [--no-pager] [--config] [--config-file]
[-h|--help] <OPERATION>
π¦ DESCRIPTION π¦
Create a new operation that restores the repo to an earlier state π
Basically: this takes your repo back to exactly how it looked at the operation you point at, which lowkey means undoing every single operation that came after it. The way it does that? By making a brand new operation. So nothing is erased-erased, you're just writing a fresh operation that says "yeah we're back here now" π
π₯ OPTIONS π₯
--what<WHAT> [default:repo,remote-tracking] β which parts of the local state get restored (and yeah, you can repeat this one) π
β οΈ Heads up bestie: this option is EXPERIMENTAL.
Possible values:
repo: the jj repo state, plus local bookmarks πremote-tracking: the remote-tracking bookmarks. Do not restore these if you wanna push after the undo, okay? π
-h,--helpβ print help (or, if you want the short lil summary, hit it with-h) β¨- <OPERATION> β the operation you're restoring to π―
Find the one you want with jj op log. And if you wanna peep what the repo looked like at that operation before you commit to the restore, run something like jj --at-op=<operation ID> log first. Look before you leap, queen π
π GLOBAL OPTIONS π
-R,--repository<REPOSITORY> β path to the repository you wanna operate on ποΈ
Default behavior? Jujutsu goes searching for the closest .jj/ directory in an ancestor of wherever your current working directory is. It'll find it, she's thorough π
--ignore-working-copyβ don't snapshot the working copy, and don't update it either π
So normally, Jujutsu snapshots the working copy at the start of every command. And at the end of the command it updates the working copy too, but only if the command modified the working-copy commit (@). If you'd rather not snapshot and just look at a possibly-stale working-copy commit instead, this is your flag. It's giving "great for a command prompt", especially if you've got another process out there committing the working copy π
Also, loading the repo at a specific operation with --at-operation implies --ignore-working-copy. They're a package deal, no cap π
--no-integrate-operationβ run the command like normal but don't integrate any operations π«
When you pass this, the operations still get created as usual, they just don't get integrated into the operation log. And the working copy doesn't get updated either. Periodt.
The command will print the resulting operation ID. You can hand that ID to e.g. jj --at-op to inspect the resulting repo state, or pass it to jj op restore to restore the repo to that state. You can also pass the ID to jj op integrate to integrate the operation π«Ά
π But fr fr, note that this does not prevent side effects outside the repo. Like, jj git push --no-integrate-operation will still perform the push. The push is happening, bestie.
--ignore-immutableβ allow rewriting immutable commits π±
By default, Jujutsu prevents rewriting commits in the configured set of immutable commits. This option disables that check and lets you rewrite any commit but the root commit. Root stays untouchable, she's iconic like that π³
This option only affects the check. It does not affect the immutable_heads() revset or the immutable template keyword. Just the check, nothing else, iykyk β¨
--at-operation<AT_OPERATION> β the operation to load the repo at β³
By default, Jujutsu loads the repo at the most recent operation, or at the merge of the divergent operations if there are any.
You can use --at-op=<operation ID> to see what the repo looked like at an earlier operation. For example, jj --at-op=<operation ID> st will show you what jj st would have shown you when the given operation had just finished. And --at-op=@ is pretty much the same as the default, except divergent operations will never be merged π
Use jj op log to find the operation ID you want. Any unambiguous prefix of the operation ID is enough β you don't gotta type the whole thing, queen π
When loading the repo at an earlier operation, the working copy gets ignored, exactly as if --ignore-working-copy had been specified.
And yes, it is possible to run mutating commands while loading the repo at an earlier operation. Doing that is equivalent to having run concurrent commands starting at the earlier operation. There's rarely a reason to do that, but it is possible π (main character energy, slightly chaotic edition)
--debugβ enable debug logging π--color<WHEN> β when to colorize output π
Possible values:
alwaysneverdebugauto
--quietβ silence non-primary command output π€«
For example, jj file list will still list files, but it won't tell you if the working copy was snapshotted or if descendants were rebased.
Warnings and errors will still be printed though. Silence isn't total silence, bestie π’
--no-pagerβ disable the pager π--config<NAME=VALUE> β additional configuration options (and yep, this can be repeated) βοΈ
The name should be specified as TOML dotted keys. The value should be specified as a TOML expression. And if the string value isn't enclosed by any TOML constructs (such as array notation), the quotes can be omitted π
--config-file<PATH> β additional configuration files (you guessed it, this can be repeated too) π
That's the whole page, bestie π this one lives in the General Commands Manual, with restore sitting pretty on the left of the footer and jj-operation-restore(1) holding it down on the right. Go forth and un-do things responsibly π¦β¨
π¦ where this page comes from
- alpine 3.24: jujutsu-doc 0.42.0-r0 Β· Apache-2.0
- arch rolling: jujutsu 0.46.0-1 Β· Apache-2.0
- nixos 26.05: jujutsu 0.41.0
- nixpkgs unstable: jujutsu 0.46.0
- ubuntu stonking: jujutsu 0.44.0-1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms