|
| 1 | +# TAGLINE |
| 2 | + |
| 3 | +abandon operations from Jujutsu's operation log |
| 4 | + |
| 5 | +# TLDR |
| 6 | + |
| 7 | +**Abandon a specific operation** |
| 8 | + |
| 9 | +```jj operation abandon [operation-id]``` |
| 10 | + |
| 11 | +**Abandon an operation and all of its ancestors** (discard old history) |
| 12 | + |
| 13 | +```jj op abandon ..[operation-id]``` |
| 14 | + |
| 15 | +**Discard recent operations** after restoring to an earlier state |
| 16 | + |
| 17 | +```jj op restore [operation-id] && jj op abandon [operation-id]..@-``` |
| 18 | + |
| 19 | +**List operations** before choosing what to abandon |
| 20 | + |
| 21 | +```jj op log``` |
| 22 | + |
| 23 | +**Garbage-collect** objects made unreachable by abandon |
| 24 | + |
| 25 | +```jj util gc``` |
| 26 | + |
| 27 | +# SYNOPSIS |
| 28 | + |
| 29 | +**jj** **operation** **abandon** _operation_ |
| 30 | + |
| 31 | +# PARAMETERS |
| 32 | + |
| 33 | +_OPERATION_ |
| 34 | +> The operation or operation range to abandon. Range syntax such as `..<id>` (ancestors through that operation) and `<id>..@-` (from that operation up to the parent of the current operation) is accepted. |
| 35 | +
|
| 36 | +**--help** |
| 37 | +> Display help information. |
| 38 | +
|
| 39 | +# DESCRIPTION |
| 40 | + |
| 41 | +**jj operation abandon** (alias **jj op abandon**) removes operations from Jujutsu's operation log. Every mutating **jj** command records an operation; abandoning those records is how you shrink the log and make old commits, views, and predecessors eligible for garbage collection. |
| 42 | + |
| 43 | +To discard **old** history, pass a range ending at the last operation you want gone: **jj op abandon ..<operation ID>** abandons that operation and all of its ancestors. Descendants of the abandoned operations are reparented onto the root operation so the remaining log stays connected. |
| 44 | + |
| 45 | +To discard **recent** history after a restore, first run **jj op restore <operation ID>**, then **jj op abandon <operation ID>..@-**. Restore creates a new operation that points the repo at the earlier view; abandon then drops the now-unwanted later operations from the log. |
| 46 | + |
| 47 | +Previous versions of a change (predecessors) are also discarded when they become unreachable from the operation history. The abandoned operations, commits, and other unreachable objects can later be collected with **jj util gc**. This is not **jj abandon**, which hides revisions in the commit graph rather than operations in the operation log. |
| 48 | + |
| 49 | +# CAVEATS |
| 50 | + |
| 51 | +Subcommand of **jj**. Operation IDs come from **jj op log**, not from **jj log**. Abandoning is not the same as **jj undo** or **jj op restore**: those create new operations; this removes operations. After a large abandon, run **jj util gc** if you want the on-disk objects reclaimed. Do not confuse this with **jj abandon**, which abandons revisions. |
| 52 | + |
| 53 | +# INSTALL |
| 54 | + |
| 55 | +```pacman: sudo pacman -S jujutsu``` |
| 56 | + |
| 57 | +```apk: sudo apk add jujutsu``` |
| 58 | + |
| 59 | +```zypper: sudo zypper install jujutsu``` |
| 60 | + |
| 61 | +```brew: brew install jujutsu``` |
| 62 | + |
| 63 | +```nix: nix profile install nixpkgs#jujutsu``` |
| 64 | + |
| 65 | +<!-- packages: 2026-09-11 --> |
| 66 | + |
| 67 | +# SEE ALSO |
| 68 | + |
| 69 | +[jj-operation](/man/jj-operation)(1), [jj-operation-log](/man/jj-operation-log)(1), [jj-operation-restore](/man/jj-operation-restore)(1), [jj-operation-revert](/man/jj-operation-revert)(1), [jj-abandon](/man/jj-abandon)(1), [jj-undo](/man/jj-undo)(1), [jj](/man/jj)(1) |
| 70 | + |
| 71 | +# RESOURCES |
| 72 | + |
| 73 | +```[Source code](https://github.com/jj-vcs/jj)``` |
| 74 | + |
| 75 | +```[Homepage](https://jj-vcs.github.io/jj/)``` |
| 76 | + |
| 77 | +```[Documentation](https://docs.jj-vcs.dev/latest/cli-reference/#jj-operation-abandon)``` |
| 78 | + |
| 79 | +<!-- verified: 2026-09-11 --> |
0 commit comments