We all love git commit --amend [-a[m "blah"]] for at least one reason, you can edit the original commit message without needing to manually copy original commit message first. Unlike hg rollback-and-hg commit, which requires you to backup the commit message on your own.

If the commit message is a one-liner, I usually use history search to re-commit with previous commit command and edit the message if required. But sometimes, the commit message has more than one line, although it doesn’t take long to copy the original message, but it still takes time.

I felt there may be a tip for an easier solution, so I searched for one, then I gasped “You gotta be kidding me!” when I saw the solution, a really simple solution.

Since Mercurial 2.2, which was released on 2012-05-01, you can do exactly the same as you do with Git, that is hg ci --amend. Basically, this new option has been around for 1 year and almost 4 months and I just learned about its existence.

It means I basically had been doing re-committing or editing very inefficiently for a long time. If I want to defend myself, than my excuse would be this:

 % sudo genlop mercurial
 * dev-util/mercurial

[snip]
     Tue May  8 08:59:24 2012 >>> dev-vcs/mercurial-2.1.1
     Mon Feb  4 02:04:34 2013 >>> dev-vcs/mercurial-2.4.2

Only six months, just only.

Admittedly, I don’t read changelog as you can already tell. At least not until I encounter a bug. This lesson teaches me, maybe I should read changelog more often. Well, still not gonna happen, we ain’t got no time for that!