12

Ill explain my problem,

I am currently using an in-house install of gitorious using git. I would like to begin testing FogBugz and Kiln from Fog Creek which uses mercurial. I would like to for at a least a short while continue development using both solutions.

Does anyone know of any long term serious effects of having a git and a mercurial repo in the same directory. Or is there a better way of keeping git and mercurial server in sync.

Ive tried it with a test repo and I haven't seen any issues.

Thanks for any help.

1
  • 1
    I don't think there would be much of an issue, as they are both isolated unlike svn's .svn files.
    – Josh K
    Aug 30, 2011 at 20:57

2 Answers 2

9

I've found the hg-git bridge fairly usable going the other direction (exposing some stuff on Github that was originally built using Mercurial for source control). Basically, you "just" use mercurial, create a bookmark linking "master" to the "default" when you're ready to push to a git repo, and push. Pull from git works similarly to the way it does when you pull from a remote repo. You don't end up with .git + .hg files in this scenario, you just have mercurial ones on your local box, unless you end up migrating over to git entirely, in which case you'd probably do git clone in a new directory.

There's a similar project for git users that want to push/pull from Mercurial repositories, but I don't have direct experience with it. See https://github.com/offbytwo/git-hg

Other than the potential of accidentally checking in a bunch of the hidden folders from your "other" source control system, I don't see any real problem with doing hg init in a git repo; it just seems less clunky to me to use a bridge, and explicitly choose when to push to the other dvcs system.

2
  • I've found hg-git a bit hit & miss with SSH and it's less than fun to set up. You can run both DVCS clients on the same machine, no probs. In fact if you're using one for source control and the other to push to production (Azure, Appharbor etc) then this can work well.
    – CAD bloke
    Dec 4, 2012 at 3:01
  • have a look under the .hg folder. hg-git creates a .git folder there unless you specify [git] intree = true in your .hgrc / ini file for mercurial.
    – CAD bloke
    Dec 4, 2012 at 3:03
9

I have used both mercurial and git on the same project, in the same working directory. The great thing about using these two DVCS's is that they both only have one folder (.git/.hg) for their confs and blobs and trees and stuff.

Just put .hg in .gitignore (and .git in .hgignore) and you are more than good to go.

You of course have to double the work when committing, but I didn't find this to hard to manage.

This setup in my opinion is far more reliable than using any bridge solutions (I don't like them since the horror I had with git-svn).

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.