📅 2010-Aug-06 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ branching, mercurial, merging, tortoisehg ⬩ 📚 Archive
Mercurial users keep insisting that you do not really need to create actual branches to work. But, if you are one of the few who likes to do this, merging branches is just as easy too. I use TortoiseHg, but the equivalent command-line options are just as obvious.
Consider branches A and B. You wish to merge B to A, so that work on A can continue. Typically, A might be the default branch and B can be a feature branch.
Finish, test and commit all the files on both branches A and B.
Open Repository Explorer. Update the working directory to branch A. This can be done by choosing the head of branch A, right-click and choose Update.
Choose the head of branch B, right-click and choose Merge with. Tip of branch A will automatically be chosen as the target for the merge. Click Merge.
Mercurial will try to merge the files automatically as much as possible. For the files with merge conflicts, it will pop up KDiff3 windows so you can pick the changes you want merged. The conflict windows are displayed sequentially, finish one and the next one is displayed.
Settle all the conflicts and your merge is done! Branch B should be connected to branch A nicely in the graph displayed in Repository Explorer now.