问题
I am using TortoiseHg.
I did a false commit, and then another false commit.
Both commits are in draft state (not yet pushed).
I want to completely ignore this commits and go back as if they where never committed.
Doing Rollback seems to only remove the last commit.
How can I do that simple task?
回答1:
In settings enable either the mq
or strip
extension, then in a changeset context menu use Modify History -> Strip
回答2:
In a recent mercurial (since v2.8 I think), you can make changesets obsolete which hides them from most views, yet they are still there if you find you ever want them. This is the recommended way to do what you want.
Lets say the most recent changeset is 132 and the latest good change is 130. Simply make changesets 131 & 132 obsolete like this:
hg prune -r 131::132
Couldn't be simpler (just make sure the current parent isn't one of the unwanted changesets).
If you find you want to see the contents of the obsolete changesets, just add --hidden to the normal command line, e.g.:
hg log -r 120::132 --hidden
NB. Tortoise has a feature to view obsolete changesets, but I don't believe it yet has the ability to make them obsolete.
回答3:
You can rollback twice for two bad commits
Follow-up to discussion with @zerkms
MQ contained strip to Mercurial (TortoiseHG) before 2.8. Now it's independent extension, which have to be enabled in Extensions (see 1) without MQ (see 2)
and after it Strip will appear in "Modify history" menu of context-menu for changeset
来源:https://stackoverflow.com/questions/27830246/discarding-more-than-one-commit-in-tortoisehg