I have cloned the default branch of a big repository and now I wish to pull from the server using the TortoiseHg client.

However, TortoiseHg proposes to pull from all the branches. Is it possible to instruct it to pull from the current branch only?

So far I have seen suggestions to:

  • Setup a hook on the client side to reject pulls from unwanted branches
  • Check incoming revisions in TortoiseHg and only pull the ones belonging to the current branch
  • Use the Mercurial ACL extension to deny access to all the branches, but the current one.

I dislike all of these solutions, since all of them are client based. In all of them TortoiseHg actually pulls all of the branches (even in the second, where the pulled revisions are arranged into a bundle presented in the incoming revisions view)

Is there an hg pull -b BRANCH equivalent in TortoiseHg?



I know how to do all of this using the Mercurial command line client - hg.exe. This question is specifically about the TortoiseHg GUI client.

  • Have you tried doing this from the workbench? I'm not using Hg at work, so I can't test it here. – MBraedley Nov 14 '11 at 14:48
  • I am using the workbench all the time and I could find any option there which would tell it to pull the current or the certain branch only. – mark Nov 14 '11 at 14:56

This can be done from the Synchronize area of the Workbench. Click the Synchronize entry on the View menu or the Synchronize toolbar icon (2 green arrows appearing to form a circle). In the bottom right pane, click Options. Enter the branch name you'd like to pull in the Branch: edit box. Finish the pull as usual.

  • 2
    This seem to be working. I'd suggest to specify . as the branch name, this way it will always refer to the branch you're working on. – Helgi Apr 24 '12 at 15:27
  • 2
    Just a note for others: There is a Synchronize entry under the Repository menu. That is not the entry you are looking for. – George Marian Dec 12 '15 at 2:34
  • @GeorgeMarian ha good point. It would be much better if the one under View was called "Sync options" or "Synchronisation". That option does not actually perform the action of Synchronise :) – O'Rooney Jun 15 '16 at 3:36
hg pull -r <branch name>  

For more info: https://stackoverflow.com/questions/5796908/mercurial-how-can-i-import-only-some-changesets-from-a-repository/5798221#5798221

  • 1
    I have edited the question body. – mark Nov 14 '11 at 14:39
  • 1
    @Kaymar it is -b for pulling a branch. -r is for a revision. From help for hg pull: -r --rev REV [+] a remote changeset intended to be added ... -b --branch BRANCH [+] a specific branch you would like to pull – DaveInCaz Sep 23 '16 at 11:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.