📅 2019-Sep-20 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ git, mercurial ⬩ 📚 Archive
With Mercurial losing the DVCS race to Git, I had a bunch of Hg repositories that I needed to convert to Git. I did that using the hg-git extension to Mercurial like this:
$ hg clone ssh://firstname.lastname@example.org/durin42/hg-git
hg-git is available through PyPI, but I had problems when I used it. hg-git is also available on a Github mirror. However, that mirror has not been updated since 2016 and I ran into problems when I used the tool.
[extensions] hggit = /path/to/hg-git/hggit hgext.bookmarks =
$ pip install -U --user dulwich
$ git init --bare foobar_git_bare
hgbookmark at the top:
$ hg bookmarks hg
$ hg push /path/to/foobar_git_bare
$ git clone foobar_git_bare foobar_git
You can change to the
foobar_git repository and view all your commits and branches from the old Mercurial repository. This Git repository is now ready for action.
originremote and push it:
$ git remote remove origin $ git remote add origin email@example.com:joe/foobar.git $ git push --set-upstream origin master
Tried with: Mercurial 4.5.3 and Git 2.17.1