Every write to a change is an operation in the forge’s log: a start, each snapshot, a rebase, an abandon. af undo takes back your last one, as jj’s undo does: each change it wrote goes back where it found it, and your workspace’s files follow. af redo puts it forward again.
Take back an edit
Start a server and a change, and save a file twice:
$ af-server --dev
...$ source ~/af-dev/dev/env
$ af workspace add ~/demo
Workspace at /home/you/demo
Paths: **
main has no landing yet
$ cd ~/demo
$ af new -m "Write the plan"
Working on change ykyuxxslwltpmzttzmszwkrwqpzwppup at commit a6a6e60753beb6ab4378070b337641cb9aaaca931755a4b545c1e38e9970b810
$ printf 'draft one\n' > plan.txt
$ af status
Change ykyuxxslwltpmzttzmszwkrwqpzwppup (open) at commit 48ca064cf506139f548f9fd8da0d28deb1995d4bd3b817c17ec06d44c3d7fe61
Landing waits for: scan
$ printf 'draft two\n' > plan.txtLike every command, af undo snapshots your files first, so the second draft is the operation it takes back:
$ af undo
undid operation 63174cf86322: 1 change put back, as operation 75ed1ce6670d
$ cat plan.txt
draft oneaf redo puts it forward, but only right after an undo: any operation of yours since ends it, as in jj.
$ af redo
redid operation 75ed1ce6670d: 1 change put back, as operation a2cf3219cbed
$ cat plan.txt
draft two
$ af redo
Error: InvalidState: there is nothing to redo: your last operation was no undo
[1]Take back an earlier operation
af op log lists the repository’s operations newest first, as jj op log does: each with the start of its id, when it ended, what it did and who did it, whether it was undone, and “you can undo it” on each you could take back now. Name one by the start of its id, as the log shows it:
af undo 63174cf86322The log shows each operation by at least twelve digits, and by more where twelve would also start another. The start you give must belong to one operation only; one that several share is refused, naming each of them by enough digits to tell them apart. An operation of an agent you started is yours to take back too, even after the agent has stopped.
A name is answered once. If af undo is retried after a lost connection, the forge answers the retry as it answered the first try: the same operation taken back, or the same refusal, even if operations written since now start the same digits. To name an operation again after a refusal, run af undo again: a new command is a new request.
See what an operation did
af op show shows one operation, as jj op show does: the log’s line for it, its parents, and each change it wrote as it was before and after, with the paths it changed there. Name it as af undo names one, by the start of its id:
$ af op show 63174cf86322
63174cf86322 2026-11-24T13:46:10.512Z snapshot by you, undo candidate
Parents: 4e91c07a2b5d
ykyuxxslwltpmzttzmszwkrwqpzwppup open 48ca064cf506 -> open 9d3f5a17c2e8
M plan.txtA change an operation started shows as (new) before it, and its paths are the ones it holds against the commit it started on. Each change lists at most 20 paths; --paths changes how many.
Compare two operations
af op diff compares two operations, as jj op diff does: each change as it stood at the first and at the second, with the paths that changed between. With no operations named, it compares the newest with the one before it:
$ af op diff
From operation: 75ed1ce6670d 2026-11-25T12:44:16.752Z undo by you, redone
To operation: a2cf3219cbed 2026-11-25T12:44:16.813Z redo by you
Changed changes:
ykyuxxslwltpmzttzmszwkrwqpzwppup open 48ca064cf506 -> open 9d3f5a17c2e8
M plan.txtHere the newest operation is the redo, and the one before it the undo it took back: the plan stood at its first draft after the undo and at its second after the redo. Name either end with --from and --to, by the start of its id. A change that ended as it began is left out, as is a change written and then taken back. If the forge no longer keeps part of the history between the two, it refuses rather than show less than happened.
If an undo stops partway
From a workspace, af undo and af redo take a few steps. They record the request in the workspace, save the files you have changed as a snapshot, take back the operation, and bring the files to the result. If the command stops partway, from a lost connection, a closed terminal or a crash, run the same command again. It picks up where it stopped, and the result is the same as if it had run once: one snapshot, one undo.
Until it finishes, other commands that would save the workspace’s files, such as af new or af status, refuse to run and say the undo is unfinished. af sync refuses too, unless only the files are left to bring, in which case it brings them and finishes the undo.
The snapshot it saves is the one it found before it stopped, never what is on disk by the time you run it again. If you edited those files in between, and the snapshot hadn’t been saved yet, nothing is taken back, and af undo says the files changed before the snapshot was saved. Run it once more to undo with the files as they are now. If the snapshot had been saved, the undo goes ahead, and your later edits stay on disk.
What an undo never does
An undo puts back only what is still as the operation left it. If a change it wrote has been written since, by anyone, the whole undo is refused and nothing moves, so one person’s undo never overwrites another’s work. A change that was submitted, returned or landed since is refused the same way: take back a landing with af revert, which makes a new change.
A snapshot is always one operation, however many files it records and however many messages it took to send, so one undo takes back all of it, never part. If the connection drops while a snapshot is being sent, nothing of it is published until all of it is.
Undoing the start of a change abandons it, as jj’s undo of new does; af redo opens it again. Each path an undo puts back must be one you may write, and contents an administrator purged never come back.
You take back your own operations, and those of the agents you started; your undo is recorded as an operation of its own, so the log shows both.
Next
af undo,af redoandaf opin the reference.- What the forge records: the operation log every write goes into.