Bazaar has a wonderful uncommit
command, which simply undoes the last commit. Is there any equivalent in Mercurial?
Edit: Bazaar's uncommit command does not modify files – it removes the last commit and associated data (useful, for example, when you notice too late that there is a typo in a commit message or a file wasn't added that should have been).
For example:
$ bzr ci -m "Fixed a proooblem" <-- problem is misspelt
$ bzr uncommit
...
$ bzr ci -m "Fixed a problem" <-- Exactly as if the first commit was correct.
Maybe hg backout tip
? I recommend http://hgbook.red-bean.com/read/finding-and-fixing-mistakes.html for all details about hg backout
, how it differs from hg revert
, and many related topics, but if I undestand what uncommit
does, it does seem exactly equivalent to hg backout tip
.
Edit: in a comment you've now clarified you want to "delete history" -- that's hard (unless you're VERY fast on the draw, maybe;-)... per the red-bean book again:
Since Mercurial treats history as accumulative—every change builds on top of all changes that preceded it—you generally can't just make disastrous changes disappear. The one exception is when you've just committed a change, and it hasn't been pushed or pulled into another repository. That's when you can safely use the hg rollback command
So if you just want to try to "make it disappear" (and you're lucky enough that it hasn't yet been pushed or pulled elsewhere), then hg rollback
may be a better approach!