Mercurial - backout an old merge

前端 未结 6 1657
礼貌的吻别
礼貌的吻别 2021-02-13 02:24

I have a branch that looks like this:

A->B->C->D->...->Z
     ^
1->2-^

where C is a merge from 2 an

6条回答
  •  旧巷少年郎
    2021-02-13 03:06

    A little bit late, but I had the same situation a while ago. This worked for me smoothly:

    hg update -C -r "revision-C"
    hg revert --all -r "revision-B"
    hg commit -m 'UNDO blah blah whatever the merge did'
    hg update -C -r "revision-Z-or-whatever-the-current-head-is"
    hg merge -r "the-new-revision-created-in-step-3"
    

    Basically, this is exactly what backout does.

    DISCLAIMER: Please note however that if you later in the future want to merge the 1->2 branch again, you will most probably run into some issues. And "some issues" is a somewhat euphemestic term here. In fact, even BIG PROBLEMS may appear in such a case. This scenario is dangerous mainly because the problems may arise much later and totally unexpected. It is highly recommended to abandon the "1" branch completely to avoid these risks. (Also see the comments below.)

    For details, see Backout wiki page.

提交回复
热议问题