Throw away edits to one file

tovio restore, the one command that can lose work.

Written By Dustin

Last updated 32 minutes ago

tovio restore <file>

Discards your uncommitted edits to that file, returning it to its content at the current lane's tip. The equivalent of git checkout -- file. It takes exactly one repository-root-relative path — there is no glob form and no flags — and it rewrites no history.

The committed file mode is restored too, so an executable script comes back executable.

This is the one that loses work

Uncommitted edits are not in the op-log, because they were never an operation. tovio undo cannot bring them back. This is the main command in TOVIO capable of destroying something unrecoverably, and it is worth pausing before it.

The safer habit

Commit first, then undo. A commit is cheap, and once the edit is a change you can reverse it, split it, or abandon it — all reversibly.

tovio commit -m "wip"tovio undo            # if you change your mind

When it refuses

SituationCode
The path is not present at the lane tip — an untracked or newly-added file has no committed version to restore toTVO-CLI-011, exit 2
The path is a materialized conflict, so there is no single committed version; resolve it firstTVO-CLI-012, exit 2
The file is protected and this repository holds no identity to decrypt it withTVO-KEY-002, exit 11
The file is protected and you are not one of its recipientsa crypto denial, exit 11 — never plaintext, never an empty file

Under --json a success is {"restored": "<path>", "from": "<commit>"}.

Discarding a whole change instead

tovio change abandon <id>tovio change restore <id>   # if you were wrong

Abandoning sets a change aside: hidden from tovio change list and not landable, but nothing is deleted and its history is kept. change restore <id> brings it back.

Reversing something already landed

tovio revert <rev>tovio revert <merge> --mainline 1

Writes a new change that inverts the named one, rather than removing it from history. For a merge you must say which parent's line to keep — which side to un-apply is a judgement, never a default.

Where to find it

restore is Advanced-tier, so it is hidden from the default tovio help index. It still runs — tovio help --all lists it, and tovio help restore prints its full help regardless of tier.