Undo an hg push (backout?)

前端 未结 4 1422
野趣味
野趣味 2020-12-24 01:38

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 ma

4条回答
  •  暖寄归人
    2020-12-24 01:57

    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.

    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.


    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"
    

    Or you could be more kosher:

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

提交回复
热议问题