Converting Mercurial folder to a Git repository

后端 未结 9 2045
情话喂你
情话喂你 2020-12-04 05:21

I don\'t have a huge experience with Mercurial, I\'m mostly a Git guy.

I would love to mirror a specific Mercurial folder/file in a git Repository. What I\'m actuall

9条回答
  •  無奈伤痛
    2020-12-04 05:45

    Windows: TortoiseHG Hg-Git extension

    Hg-Git can be used to convert a Mercurial repository to Git. You can use a local repository or a remote repository accessed via SSH, HTTP or HTTPS.

    Example of local repositories conversion.

    1. Install Hg-Git.

      • On Windows, TortoiseHg comes with Hg-Git, though you need to enable it via the setting tool (in extensions section)

        or manually in ~/mercurial.ini

        [extensions]
        hggit =
        
    2. Use the following commands to convert the repository:

      $ mkdir git-repo; cd git-repo; git init; cd ..
      $ cd hg-repo
      $ hg bookmarks hg
      $ hg push ../git-repo
      

    The hg bookmark is necessary to prevent problems as otherwise hg-git pushes to the currently checked out branch confusing Git. This will create a branch named hg in the Git repository. To get the changes in master use the following commands (only necessary in the first run, later just use git merge or rebase):

    $ cd git-repo
    $ git checkout -b master hg
    

提交回复
热议问题