Discarding more than one commit in TortoiseHg

别说谁变了你拦得住时间么 提交于 2019-12-25 16:53:33

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!