Converting a Mercurial (hg) repository to Git on Windows (7)

后端 未结 6 1642
别跟我提以往
别跟我提以往 2020-12-02 11:21

I\'m really quite frustrated at this point. I have an existing hg repository that has months of coding history in it, and I want to get this into a private Github repository

6条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-02 12:02

    There is a lot of conflicting information about how to convert Mercurial repositories to Git on Windows. It really is pretty easy and only requires TortoiseHg and Git to be installed.

    Preparation

    Enable hg-git by adding the following to your Mercurial config file (%Userprofile%\mercurial.ini):

    [extensions]
    hggit = 
    hgext.bookmarks =
    
    [git]
    intree = True
    

    Conversion

    Navigate to the repository directory (that contains the .hg subdirectory) on the command line and execute the following commands:

    hg bookmark -r default master
    hg gexport --debug
    git config --bool core.bare false
    git reset HEAD -- .
    

    More information

    You can find a detailed description of these steps in my blog article on the subject.

提交回复
热议问题