[issue1010] Command to back out a bad merge

Jesse Glick mercurial-bugs at selenic.com
Fri Feb 29 12:44:33 CST 2008

New submission from Jesse Glick <jesse.glick at sun.com>:

When someone bungles a merge and winds up committing a completely wrong merge
changeset and pushing it to a public repository, it is hard enough to find it
(see Issue981), but even if you, it is not obvious how to revert it.

'hg backout' is probably wrong; you would have to pass it one or the other merge
parent, but this would result in a changeset identical to one merge parent which
claims it is a merge when it really isn't.

You can redo the merge (hg up -r $bad^1 && hg merge $bad^2 && hg ci) but there
are likely plenty of other changesets on top of the bad merge, so you need to
mark your good merge as somehow superseding the bad one. Perhaps you should
pretend to merge against the bad changeset and discard all changes? But I have
tried this and it does not seem to help; still results in massive strange
file-level conflicts when I try to merge with other heads (bos investigating).
Anyway this is hardly straightforward.

Would appreciate an option for 'hg backout' to undo the effects of a merge,
presumably requiring you to redo the merge properly, in such a way that you can
then merge against later changesets and have everything be "clean" again.

messages: 5438
nosy: bos, jglick
priority: feature
status: unread
title: Command to back out a bad merge
topic: merge

Mercurial issue tracker <mercurial-bugs at selenic.com>

More information about the Mercurial-devel mailing list