How do you "rollback" last commit on Mercurial?

commit, mercurial, rollback

Solution

You just need this command:

hg rollback

See: http://hgbook.red-bean.com/read/finding-and-fixing-mistakes.html.

(Technically, this is deprecated as of version 2.7, August 2013, but I've yet to see an alternative that does exactly the same thing.)

Problem

I have a Mercurial repository that I use in local only... It's for my personal usage (so I don't "push" anywhere). I made a commit with 3 files, but after that I understood that I should do commit 4 files... Is there a way to "rollback" my last (latest, only one) commit, and "recommit" it with the correct files? (I don't know why, but my "Amend current revision" option is not active, so I can't use it...)

Original source

Related problems