Mercurial move changes to a new branch

后端 未结 4 1585
滥情空心
滥情空心 2020-12-04 05:21

I have a number of changes that I committed to my local repository, but have not yet been pushed. Since on a feature is taking longer than expected, I want to swap these ch

4条回答
  •  臣服心动
    2020-12-04 05:54

    For those inclined to use GUI

    1. Go to Tortoise Hg -> File -> Settings then tick rebase .

    1. Restart tortoise UI

    2. Create new branch where you will be moving changes. Click on current branch name -> choose Open a new named branch -> choose branch name.

    1. If changes you want to move have not been made public (e.g draft) go to 5. (If changes have already been published and you are not a senior dev you should talk to someone senior (get a scapegoat) as you might screw things up big time, I don't take any responsibility :) ).

    Go to View -> Show Console (or Ctrl + L) then write in console hg phase -f -d 2 - where 2 is lowest revision you will be moving to new branch.

    1. Go to branch and revision (should be topmost revision if you are moving changes to new branch created in step 3.) Right Mouse -> Update

    2. Go to branch and revsion you will be moving changes from Right Mouse -> Modify History -> Rebase

    1. Click Rebase and pray there are no conflicts, merge if you must.

    2. Push changes, at this point all revisions should still be draft.

    3. Go to topmost revision in branch you were moving changes to Right Mouse -> Change Phase to -> Public.

    Hope this saves you some time.

提交回复
热议问题