Fix the last commit without breaking its identity

commit --amend keeps the stable change id.

Written By Dustin

Last updated 30 minutes ago

tovio commit --amend

Folds your current edits into the last commit. This is the everyday “I forgot a file” fix.

What happens to the message

tovio commit --amend                  # keep the existing messagetovio commit --amend -m "better message"   # rewrite it

Unlike a plain commit, --amend does not require -m and does not prompt for one: the previous message is kept when you omit it.

The part that differs from Git

Amending produces a new commit hash — content addressing guarantees that. But the change id (chg:) stays the same.

That is the whole point. In Git, amending orphans anything attached to the old commit: a review, a comment, a reference from a colleague. In TOVIO those are attached to the change, and the change survived. A review of your change is still a review of your change after you amend it.

On a lane with no commits

There is no tip to fold into and no message to rewrite, so the amend is refused with TVO-OP-020 (“Nothing to amend on this lane”, exit 19). Make the first commit with a plain tovio commit -m "…".

Amending something already shared

Safe in a way it is not in Git. Because lanes converge rather than diverge, a colleague who already pulled does not get a “diverged history” error — they get the amended change. They may get a content conflict if they had edited the same lines, which is a real disagreement rather than an artefact of the rewrite.

Undoing an amend

tovio undo

The amend is one op-log operation, so one undo puts the previous commit back.