Rollback multiple commits (before Pushed to public

2019-03-23 09:05发布

I am aware that rollbacks can remove commits from the latest changeset in a local repository. However, is it possible to remove all the latest commits since the previous push without having to re-clone the share repository?

3条回答
干净又极端
2楼-- · 2019-03-23 09:15

If you are using mercurial eclipse, you can rollback once, then shelve those changes, then export the multiple sequential commits as patches, strip those commits, then import those patches in the same order, so in case you had conflicting patches, they overwrite each other in the desired way.

Finally you can unshelve your first rollback. This achieves the same effect as if you were rolling back more than once.

查看更多
唯我独甜
3楼-- · 2019-03-23 09:20

You could make a new repo with hg clone:

hg clone -r last_good_changeset localrepo newlocalrepo
查看更多
Animai°情兽
4楼-- · 2019-03-23 09:26

You can use the hg strip command, part of the mq extension:

hg strip REV

This will remove that revision + all its descendants.

Before you try this, make a copy/clone of the repository to experiment in.

查看更多
登录 后发表回答