Undo a commit?
Greg Ward
greg-hg at gerg.ca
Wed Jul 15 08:47:01 CDT 2009
On Wed, Jul 15, 2009 at 8:36 AM, rupert.thurner<rupert.thurner at gmail.com> wrote:
> if one looks at the wealth of commands in mercurial, it became
> quite a challenge to get into it.
I'm guessing you've never used git. ;-)
> * complicated command to do something simple and often needed:
> hg qimport -r tip ; hg qrefresh -e ; hg qfinish tip
rollback is a much easier way to do this. You might also be
interested in the histedit extension (not included with Mercurial:
search the wiki).
> * different commands for approximately the same thing, e.g.
> undo/clean:
> hg revert, hg backout, hg strip, hg rollback, hg update --clean,
> hg purge
Apart from strip and rollback, which Martin explained, these are all
pretty different. Plain vanilla revert only affects your working
copy: I just made a trial change that I don't want to commit, and it's
time to throw it away. ("revert -r" counts as advanced usage; I've
never used it.)
(OK, maybe you have a point about revert and update -C. I *think*
that "revert" == "update -C .". I'm not sure what the difference is
between "revert -r REV" == "update -C REV" is: perhaps "revert -r"
leaves the parent of the working copy alone?)
Backout is a backwards merge of an already committed change. It
records in history that you made a change and then changed your mind.
And purge is an optional extension that nobody should use unless they
understand exactly what it does. (Given that, it's *damn* useful.
Goodbye, "make clean"!) And it only affects the working copy.
Bottom line: in order to use a tool effectively, you must understand
it. Terms like "parent of the working copy" sound fancy, but I think
someone using Mercurial without a rough understanding of that (and a
few other concepts, like "every changeset except the root has 1 or 2
parents and 0 or more children") is going to get confused.
Greg
More information about the Mercurial
mailing list