Convert hg branches to git branches?

I must convert a branchy mercurial repo into a git repo AND continue to pull changes from mercurial to git (one-way only) for some time. Existing hg-to-git answers do not seem to handle branches correctly. For example, a small hg repo with ‘default’ and ‘br1’ branches results in this:

$ hg branches
br1                            3:a8914879f6bb
default                        2:4e6221bce113

cd ..
git-hg clone file:/path/to/hgrepo gitrepo

...<snip>
From .git/hgremote
 * [new branch]      br1        -> hg/br1
 * [new branch]      master     -> hg/master
From .git/hgremote
 * branch            master     -> FETCH_HEAD

cd gitrepo
git branch --list
* master

Git thinks there is only one branch ‘master’. How can I make my mercurial branches to show up as identically named git branches? I can live with ‘master’ instead of ‘default’, but I must have all my other named branches in git.

  • My coworker's changes remove my commits in git
  • Bluemix: How I can configure a delivery pipeline stage build to tag git?
  • Is there any possibility of losing changes if we do git merge?
  • git: create tag and push to remote: why tag is behind master on remote?
  • Why GitHub suggest “prefix your version names with the letter v?”
  • Why does git add&remove the Storyboard <classes> section repeatedly?
  • How can I remove all traces of a file from a git repository without removing it from the directory?
  • How do I share a papyrus project via git?
  • How to list all distinct extensions of tracked files in a git repository?
  • Changing name of project is not reflected on GitHub
  • Can't change branch or commit because of unmerged files. Can't merge or stash files because I'm in the wrong branch
  • Unable to Run Build on Hudson Using Git
  • One Solution collect form web for “Convert hg branches to git branches?”

    The branches are imported as remote branches that means they are relative to the remote repository which happens to be a hg repository. If you type git branch -a you will be able to see all branches.

    You can create local branches of those remote branches simply like this:

    git branch <localname> <remotename>
    

    For example:

    git branch br1 hg/br1
    
    Git Baby is a git and github fan, let's start git clone.