Last Updated: February 25, 2016
·
1.014K
· kingsleyadio

Pushing to a git repository from Mercurial

This tip comes handy for both mercurial and git users. For me, I've been stuck with mercurial for a while, and needed to move the codebase to git.

I had 2 goals:
1. Combine 3 projects (already version controlled individually) into 1 single repository
2. Move the version control system from mercurial to git while retaining all the commit history and changes associated with it.

Combining was actually cool, so goal 1 was achieved in no time. See https://coderwall.com/p/rxawfq

For goal 2, this link really helped alot: http://hg-git.github.io

Once goal 2 was accomplished, I discovered there are other possibilities that just got unlocked.
Since you can push/pull to a git server from mercurial, it's pretty easy to work hand-in with git users.
Also, it is possible to go the reverse direction i.e Switch your version control system from git to mercurial. Once you are able to pull the updates successfully, the choice of continuing on that git repo or moving to a mercurial based one, totally lies in your hands.

Hope this helps!