Search code examples
gitmercurialtortoisehg

Converting Mercurial to Git using TortoiseHG. No files are created


I want to convert a Mercurial project to a Git project. I am following the directions here https://stackoverflow.com/a/34853438/984003 using TortoiseHG.

  1. Enable hggit

  2. Open a command line, enter an empty directory.

  3. git init --bare .git

  4. cd to your Mercurial repository.

  5. hg bookmarks hg

  6. hg push c:/path/to/your/git/repo

  7. In the Git directory: git config --bool core.bare false

After the push command, it said

added 5815 commits with 24723 trees and 24178 blobs

So something happened. But, when I go to repo directory (the path that I pushed to), it's empty except for .git


Solution

  • @zerkmas was right in the comments.

    From c:/path/to/your/git/repo, do:

    git checkout hg
    

    And then all the files appeared.

    EDIT: In the end, this didn't work out for me either. It loses the branches.

    I ended up using GitHub's importer:

    Convert Bitbucket Mercurial repository to Git. Maintain branches and history. Online solution