How to branch with TortoiseHG

MercurialTortoisehg

Mercurial Problem Overview


I downloaded TortoiseHg 1.0 for evaluation. For the life of me I can't figure out how to make a branch. It seems to understand branches (e.g. in its repository browser) but I just can't seem to find a way to make a branch. This seems like such a fundamental capability since out of the often touted benefits of DVC is the lightweight branching.

I Googled around and couldn't find much discussion of this topic (at least for recent versions) so I have to assume I'm missing something, right?

Update: So I flagged Chad Birch's answer below to answer the "new branch" issue. As he correctly points out, you do a commit and then click on the branch button to bring up the branch maintenance dialog which is where you create new branches. I kind of wish they had given us a context menu option for this. Once you've branched, the next natural question is how to merge and this is also not obvious. It turns out that option is buried in the repository explorer. You need to select the head of another branch, right-click and then select "Merge with...".

Mercurial Solutions


Solution 1 - Mercurial

http://tortoisehg.readthedocs.io/en/latest/commit.html">As shown in the docs, all you should need to do is just click on the branch: default button near the top of the commit dialog, and change to a new branch name.

Solution 2 - Mercurial

To start new branch with TortoiseHg press Commit... then, above Commit message press Branch, then "Open new named branch: "

Solution 3 - Mercurial

Just wanted to add that in order to push new branch to remote repository there is a checkbox on the Synchronize tab under Options of "Allow push of a new branch" - you have to remember to turn it off again right afterwards.

Solution 4 - Mercurial

Most of the time in mercurial, you clone the repository to make a branch.

You can then merge the separate repositories once you made your edits and commits.

This might sound like it would take up a lot of disk space but on most operating systems, mercurial will make hardlinks instead of copying the files. Anyway, disk space is normally cheap, and because it's local it's rather fast.

If you think about it, every "checkout" (in svn terminology) or "clone" (in mercurial terminology) is really a branch that will probably be merged back so it makes lots of sense that clones are the common way of making branches.

Solution 5 - Mercurial

Before commiting, click on Branch button (see image), Then select a branch or create a new one (by typing where you select the branches).

See the image here

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionMichael TillerView Question on Stackoverflow
Solution 1 - MercurialChad BirchView Answer on Stackoverflow
Solution 2 - MercurialnmeView Answer on Stackoverflow
Solution 3 - MercurialTamWView Answer on Stackoverflow
Solution 4 - MercurialblokeleyView Answer on Stackoverflow
Solution 5 - MercurialFelipe DiasView Answer on Stackoverflow