středa 30. srpna 2017

Hg - Mercurial how to remove unwanted merge - using backout of backout

Issue
We have branches: "default" and "myB"
Into branch "default" was by mistake merged branch "myB".

Solution
One possible solution to solve this is:
Simple description: We will backout merge in "default" branch. Then we merge this backout into "myB" and then we will do "backout of this backout" in "myB" branch.

Exact way how to do it:

${merge} - revision with unwanted merge
${default_parent} - revision of parent changeset of ${merge} changeset in "default" branch
${myB_parent} - revision of parent changeset of ${merge} changeset in "myB" branch

commands:

hg update ${merge}
hg revert --all -r ${default_parent}
hg commit -m "backout of unwanted merge"   


hg update ${myB_parent}

hg merge tip
hg ci -m "merge backout into branch"

hg revert --all -r ${myB_parent}
hg commit -m "backout of backout"  



This is inspired by: https://www.mercurial-scm.org/pipermail/mercurial/2017-January/050172.html

         

Example of such revert in log:

Žádné komentáře:

Okomentovat