Revert a change that already landed

tovio revert mints a forward inverse instead of erasing anything.

Written By Dustin

Last updated About 3 hours ago

tovio revert chg:a3f7b2
tovio revert chg:a3f7b2 -m "Back out the parser rewrite"
tovio revert chg:a3f7b2 chg:9c14ef

Commits the inverse of each named change onto the current lane and updates the working copy. History is left intact: nothing is rewritten, nothing is removed, and the reverted change keeps its place in the record. Several changes are inverted in the order given.

Three tools that are not each other

CommandDoes
tovio undoReverses recent local operations from the op-log. Not synced, not a commit.
tovio rebaseRewrites history, minting new commit ids.
tovio revertAdds a new forward change that undoes an old one. Nothing is rewritten.

Revert is the one to reach for once work has left your machine.

Reverting a merge

tovio revert <merge-change> --mainline 1

A merge has more than one parent, so "the inverse" is ambiguous until you say which side to keep. --mainline 1 keeps the lane the merge landed onto — the first parent — and un-applies everything the merge brought in from the other side. Without the flag a merge revert is refused with TVO-OP-028, deliberately: picking a side by default would invert the wrong half and look like a success.

Conflicts and refusals

If the tip has since edited the lines being reverted you get a conflict object — resolve, then land. A revert whose result changes nothing (the change is already absent) is skipped rather than committed as an empty anti-change.

  • TVO-OP-028 — the target is a merge and no --mainline was given.
  • TVO-OP-029 — nothing to revert: no change was named, the lane is unborn, or the target is the initial commit and has no parent state to go back to.

-m overrides the default Revert "…" message, and applies only to a single-target revert.

Undo

tovio undo

The revert commit is an op-log operation like any other.