19

With git svn clone I can work on a subversion repository using git. Is there a similar way to work on Mercurial (hg) repositories?

Jesper Rønn-Jensen
  • 106,591
  • 44
  • 118
  • 155
  • 3
    possible duplicate of [Git interoperability with a Mercurial Repository](http://stackoverflow.com/questions/883452/git-interoperability-with-a-mercurial-repository) – poke Mar 07 '11 at 21:49
  • Title is closer match to http://stackoverflow.com/questions/1389307/convert-a-mercurial-repository-to-git – wnoise Mar 07 '11 at 22:23

3 Answers3

15

There isn't anything built in.

You can use git-hg however, which I use a lot and works great for pulling hg repos and updates to a git repo, but the downside of it is that you cannot push updates made to your git repo to a hg repo with git-hg.

erikvold
  • 15,988
  • 11
  • 54
  • 98
  • Thanks for that answer. Only pulling will probably work for me, since I was just interested in looking at source code for Mockito (which is in Mercurial) – Jesper Rønn-Jensen Mar 08 '11 at 09:09
  • 5
    This answer is out of date. [A bridge](http://felipec.wordpress.com/2012/11/13/git-remote-hg-bzr-2/) is now integrated in Git, and works fine – CharlesB Apr 09 '14 at 09:02
  • 1
    @CharlesB +1 and thanks for this hint. It comes with Ubuntu 14.04 LTS and Debian wheezy-backports these days, but is not active by default. Look into `/usr/share/doc/git/contrib/remote-helpers/` for the scripts to copy them somewhere into `$PATH` – Tino Jun 19 '14 at 23:57
3

The Mercurial extension hg-git is another way to go in the Hg->Git direction. If you just want to go in that direction, so far as I can see, it and git-hg both work well. More details here.

Community
  • 1
  • 1
dubiousjim
  • 4,722
  • 1
  • 36
  • 34
0

If it was the other case, I mean if you need a git->hg conversion you can use mercurial's Convert extension. But for your question git-hg should do fine.

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
tamizhgeek
  • 1,371
  • 3
  • 13
  • 25