Converting Mercurial folder to a Git repository

后端 未结 9 2028
情话喂你
情话喂你 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 06:02

    Gitify

    Seems as a more modern and easy to use alternative to perform the conversion https://github.com/buchuki/gitifyhg

    pip install gitifyhg
    git clone gitifyhg::<hgrepoaddress>
    # done, you have a git repo with the entire history of the hg one
    
    0 讨论(0)
  • 2020-12-04 06:02

    Maybe it helps someone today (when converting a mercurial repository to git, while retaining history). Tested to work with mercurial 4.0.1.

    ~$ git clone https://*old_hg_repo*
    ~$ git clone https://github.com/frej/fast-export.git
    ~$ cd fast-export
    ~$ git checkout tags/v180317
    ~$ cd ..
    ~$ mkdir new_git_repo
    ~$ cd new_git_repo
    ~$ git init
    ~$ .../fast-export/hg-fast-export.sh -r ../old_hg_repo/ --force
    ~$ git checkout HEAD
    

    And finally to push your newly converted local repo.

    ~$ git push REMOTE '*:*'
    
    0 讨论(0)
  • 2020-12-04 06:05

    You can (from Mercurial side):

    • using Convert extension with --filemap option convert part of original repo into smaller with only needed files|directories
    • with hg-git extension push stripped repo to Git

    or (instead of hg-git), using Mercurial bridge in Git, clone|pull repository from Git

    0 讨论(0)
提交回复
热议问题