本文介绍了如何还原上一次提交并保持更改?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有3个提交1、2和3.如何回滚2和3并仍然保留它们的更改文件?
I have three commits 1, 2 and 3. How can I rollback 2 and 3 and still keep the changed files of them??
1---2---3
=> 1 and changed files of 2 and 3
推荐答案
您使用strip
命令:
带有--keep
选项:
并且由于strip
对历史具有破坏性,因此默认情况下未启用它.您可以通过将以下几行添加到~/.hgrc
文件中来启用它:
And since strip
is destructive of history it's not enabled by default. You enable it by adding these lines to your ~/.hgrc
file:
[extensions]
strip =
因此,在这种情况下,您将执行hg strip --keep 2
So in this case you'd do hg strip --keep 2
注意:需要Mercurial 2.8或更高版本.在此之前,您需要将mq =
放在.hgrc
中.
Note: requires Mercurial 2.8 or later. Before that you need to put mq =
in the .hgrc
instead.
这篇关于如何还原上一次提交并保持更改?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!