简体   繁体   English

如何还原汞回滚?

[英]How do I revert a hg rollback?

This may sound silly but when I wanted to revert a hg merge command, I issued "hg rollback". 这听起来可能很愚蠢,但是当我想还原hg merge命令时,我发出了“ hg rollback”。

Later i realized I have to use "hg update -C -r ." 后来我意识到我必须使用“ hg update -C -r”。 to clear the merged but uncommitted changes. 清除合并但未提交的更改。

Now I want my last commit back. 现在我要我的最后一次提交。 Is this possible ? 这可能吗 ?

Maybe. 也许。 The opposite of hg rollback is hg commit . hg rollback的反义是hg commit If you didn't add/remove any files with hg add / remove / addremove , running hg commit once more should give you the state before the rollback. 如果您没有使用hg add / remove / addremove添加/删除任何文件,则再次运行hg commit为您提供回滚之前的状态。

But you're in the middle of a merge and hg commit doesn't support --dryRun , so I'm wary what would happen in this case. 但是您正处于合并过程中,并且hg commit不支持--dryRun ,因此我很警惕在这种情况下会发生什么。 You will probably get an error but I'm not sure 您可能会收到一个错误,但我不确定

To try this, just make a copy of the workspace somewhere else (ie copy the parent folder which contains the .hg folder). 要尝试此操作,只需在其他位置复制工作区(即,复制包含.hg文件夹的父文件夹)。 This is your whole project. 这是您的整个项目。 You can try to fix the mess in the copy. 您可以尝试修复副本中的混乱情况。 If something breaks, you can always delete the copy and try something else. 如果出现问题,您可以随时删除副本,然后尝试其他操作。

Alternatively, you can clone the project using hg clone . 另外,您可以使用hg clone克隆项目。 If the project already includes messed up changesets, then you can exclude them with -r . 如果项目已经包含混乱的变更集,则可以使用-r排除它们。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM