tags:

views:

87

answers:

2

hg backout tip seem to also revert all your files back to the older version. Is there a way to change it back to EXACTLY like before the commit -- that is, with several files "Modified" but uncommitted -- essentially, as if the "commit" was never done?

(hg rollback is said to be very bad and usually shouldn't be done for version control purpose)

+3  A: 

hg rollback does exactly what you are asking for - it undoes the hg commit and you end up in the state you were before you committed.

Of course it's not really in the intention of a version control system to "lose" versions you already committed, but it's handy to revert an accidental commit.

sth
the `hg rollback` is what is being avoided here... for one, it can only rollback once, so if you commit once, and twice, you can't rollback the first one. Also, if you pushed, or if someone pulled from you, then your rollback can "come back one day to bite you", when you pull from where you pushed, or when someone who pulled from you, he pushes some where and you pull from there later on.
動靜能量
+1  A: 

Once you push, of course, there is no tool that will do what you want. That being said, if you have more than one changelist that you want to remove from your local history rather than just undoing their effect with hg backout, then you can use hg strip, which is available as part of the MQ extension package.

You can do the following to get your desired effect:

hg export tip > foo.patch

hg strip tip

hg import --no-commit foo.patch

leo grrr