本文介绍了撤消hg推送(撤消?)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我做了个大动作,可以使用一些帮助来撤消它.

I made a big oops, and could use some help undoing it.

我们有两个存储库-一个相当稳定的存储库,以及一个我们要进行更改的存储库.我刚刚在稳定的存储库中进行了缺陷修复,并将其移至工作存储库中.我从稳定存储库中取出,合并,然后不小心将其推到稳定存储库中.

We have two repositories-a fairly stable repository, and a repository we're working on changes in. I just made a defect fix in our stable repository, and was moving it up to the working repository. I pulled from the stable repository, merged, then accidentally pushed to the stable repository.

稳定的存储库现在看起来像这样:

The stable repository now looks like this:

*merge
| \
|  \
|   *b
*a  |
|  /
*c

其中,a是应该作为稳定存储库的提示的提交,b是我们在开发存储库中所做的所有工作,而c是我们分支开发存储库的要点.

where a is the commit that should be the tip of the stable repository, b is all the stuff that we've done in the development repository, and c is the point we branched the development repository.

我该如何将其恢复为:

*a
|
*c

(我知道我真的无法做出改变,我只是在寻找功能结构...)

(I know I can't really make changes go away, I'm just looking for a functional structure...)

我读过一些东西,使我认为hg backout是我需要的命令,但我不确定它的作用.

I've read some things that make me think that hg backout is the command I need, but I'm not exactly sure what it does.

推荐答案

hg rollback还原上一个事务,因此您将剩下未完成的合并,必须使用hg update -C退出.

hg rollback reverts the last transaction, so you'd be left with unfinished merge, which you have to use hg update -C to get out.

如果您不希望* b(您在另一个克隆中拥有它),请启用内置的MQ扩展并运行hg strip -r <*b>.它将摆脱* b和* merge.默认情况下,它会保存备份,以防万一您再次改变主意.

If you don't want *b (you have it in another clone), then enable the built-in MQ extension and run hg strip -r <*b>. It will get rid of *b and *merge. By default it saves a backup in case you change your mind again.

更新(根据@Rudi的评论:对不起,我错过了已推送"部分)

UPDATE (per @Rudi's comment: sorry I missed the "already pushed" part)

由于合并已被推出,因此从不会执行我之前建议的操作.来自开发人员的仇恨电子邮件本来是最好的结果.

Since the merge is already pushed out, NEVER EVER do what I suggested earlier. Hate emails from fellow developers would have been the best outcome.

相反,请执行以下操作:

Do this instead:

hg up -r<*merge>
hg revert -r<*a> -a
hg ci -m "undo unintended merge"

或者您可以更讲究:

hg up -r<*merge>
hg backout -r<*merge> --parent<*a>

这篇关于撤消hg推送(撤消?)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-30 18:06