Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mercurial correct way to return to default branch

We develop new modules for our application on separate branches. When they have been tested they are merged into the default branch. When we need to make changes to a module we reopen the branch, make the changes, test and finally merge into the default branch again.

Occasionally whilst updating a module we identify bugs within our core code. Often we will fix the bug and then commit the changes back to the default branch. However, because we are in the module branch, we have to reopen "default".

This did not have the desired effect as we ended up with 2 default branches.

So what is the correct way to commit to "default" when you are within another branch without losing the changes? (preferably using TortoiseHg).

Below is a screenshot of the TortoiseHg dialog where I select the "default" branch, followed by what happens to the graph.

opening default branch

like image 241
Ben Foster Avatar asked Jan 19 '23 06:01

Ben Foster


1 Answers

  1. hg update default
  2. Do the changes
  3. hg commit
  4. hg update modulebranch

If you described your workflow correctly, this should work without creating any new head or whatsoever.

If you need to retrieve the changes in your module branch, you can add hg merge default as a fifth step.

If you have uncommited changes in your repository and don't want to commit them before updating to default, you can use the Shelve extension for example, or simply save the content of hg diff to a file that you will later reapply with hg patch.

like image 50
krtek Avatar answered Apr 29 '23 12:04

krtek