I goofed up a merge. I'd like to revert then try again.
Is there a way to revert a merge before it is committed?hg revert
doesn't do what I'd like, it only reverts the text of the files. Mercurial aborts my second attempt at merging and complains original merge is still uncommitted.
Is there a way to undo a merge after an hg merge
com开发者_运维问答mand but before it's committed?
hg update -C <one of the two merge changesets>
After you do hg merge
, but before hg commit
, your working copy has two parents: the first parent is the changeset you had updated to before the merge and the second parent is the changeset you are merging with. Mercurial will not let you do hg merge
again as long as your working copy has two parents.
You have two options on how to proceed:
If you want to abort the merge and get back to where you started, then do
hg update -C .
This will update the working copy to match the first parent: the
.
always denotes the first parent of the working copy.If you want to re-merge some files then do
hg resolve fileA fileB
This will re-launch the merge tools just as when you did
hg merge
. The resolve command is good if you find out athg merge
-time that your merge tools are configured badly: fix the configuration and runhg resolve --all
. You can runhg resolve
as many times as you want until you are satisfied with the merge.
Today there is hg merge --abort
. See hg help merge
.
精彩评论