Rebase a lane onto another

tovio rebase --onto, what survives it, and when it refuses.

Written By Dustin

Last updated 26 minutes ago

tovio rebase                        # onto maintovio rebase --onto developtovio rebase --onto chg:a3f7b2

Reparents the current change — and the stack above it — onto a new base. --onto takes a lane name or a chg: id and defaults to main. The re-derivation runs through the same three-way merge landing uses, and the whole thing is one undoable operation.

What survives

Change ids. This is the important difference from Git. A rebase produces new commit hashes — content addressing requires that — but every change keeps its chg: id. Reviews, comments, blame attribution and recorded dependencies still point at your change.

In Git a rebase orphans everything attached to the old commits, which is why teams write rules against rebasing shared branches. In TOVIO it does not, which is why rebasing a change under review is not the mistake it is elsewhere.

Rebasing one change, or a range

tovio change rebase chg:a3f7b2 --onto maintovio change rebase chg:start..chg:tip --onto develop

A buried change selects the range from that change through the lane tip. When that change is reachable from more than one live lane, TOVIO will not guess which suffix to move and refuses with TVO-OP-013 — name the range explicitly as <start>..<tip>, where the end is a live lane tip and the start is on its first-parent line. Dependent lanes are re-derived through the descendant cascade.

What can go wrong

  • TVO-OP-017 — nothing to rebase; the lane is unborn. Commit first.
  • TVO-OP-013 — the range is ambiguous, or its end is not a live lane tip. Name <start>..<tip>.
  • TVO-OP-014 — the range crosses a merge commit. Reparenting one would drop its second-parent lineage, so it is refused rather than flattened.

Rebase, or cherry-pick

rebase moves a stack: the source lane advances and its descendants follow. tovio cherry-pick is additive — it advances the target and leaves the source lane untouched. Reach for cherry-pick when you are backporting, and rebase when you are catching up.

Conflicts during a rebase

They become conflict objects. The rebase completes, the rewritten tip is not implicitly checked out, and your tree stays buildable. tovio conflicts lists what needs resolving.

Undo

tovio undo

One step reverses the whole cascade.