Fix the last commit without breaking its identity
commit --amend keeps the stable change id.
Written By Dustin
Last updated About 1 month ago
tovio commit --amendFolds 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 itUnlike 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 undoThe amend is one op-log operation, so one undo puts the previous commit back.
Was this helpful?
More in Everyday version control
See what is going on: tovio statusSee why a change was madeFilter history by human, agent, task or dateDiff your working copyStill need help? Ask the team