Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Update from June 2012. Currently there seem to be the following methods for Git/Hg interoperability when the developer wants to work from the git side:</p> <ol> <li><p>Install Mercurial and the <a href="http://hg-git.github.com/" rel="nofollow noreferrer"><strong>hg-git extension</strong></a>. You can do the latter using your package manager, or with <code>easy_install hg-git</code>. Then make sure the following is in your ~/.hgrc:</p> <pre><code>[extensions] hggit = </code></pre> <p>You may see some references that talk about specifying the <code>bookmarks</code> extension here too, but that has been built into Mercurial since v 1.8. Here are <a href="http://candidcode.com/2010/01/12/a-guide-to-converting-from-mercurial-hg-to-git-on-a-windows-client/" rel="nofollow noreferrer">some tips about installing hg-git on Windows</a>.</p> <p>Once you have hg-git, you can use commands roughly like <a href="https://stackoverflow.com/a/1089221/674840">Abderrahim Kitouni posted above</a>. This method has been <a href="http://traviscline.com/blog/2010/04/27/using-hg-git-to-work-in-git-and-push-to-hg/" rel="nofollow noreferrer">refined and tweaked</a> since 2009 though, and there is a friendly wrapper: <a href="https://github.com/abourget/git-hg-again" rel="nofollow noreferrer"><strong>git-hg-again</strong></a>. This uses the toplevel directory as a working directory for both Mercurial and Git at the same time. It creates a Mercurial bookmark that it keeps in synch with the tip of the <code>default</code> (unnamed) branch in the Mercurial repository, and it updates a local Git branch from that bookmark.</p></li> <li><p><a href="https://github.com/rfk/git-remote-hg" rel="nofollow noreferrer"><strong>git-remote-hg</strong></a> is a different wrapper, also based on the Mercurial <code>hg-git</code> extension. This additionally makes use of the <code>git-remote-helpers</code> protocols (hence its name). It uses the toplevel directory only for a Git working directory; it keeps its Mercurial repository bare. It also maintains a second bare Git repository to make synching between Git and Mercurial safer and more idiomatically gitlike.</p></li> <li><p>The <a href="https://github.com/cosmin/git-hg" rel="nofollow noreferrer"><strong>git-hg</strong></a> script (formerly maintained <a href="https://github.com/offbytwo/git-hg" rel="nofollow noreferrer">here</a>) uses a different method, based on <code>hg-fast-export</code> from the <a href="http://repo.or.cz/w/fast-export.git" rel="nofollow noreferrer"><strong>fast-export project</strong></a>. Like method 2, this also keeps a bare Mercurial repository and an additional bare Git repository.</p> <p>For pulling, this tool ignores Mercurial bookmarks and instead imports every named Mercurial branch into a Git branch, and the default (unnamed) Mercurial branch into master.</p> <p>Some commentary discusses this tool as being hg->git only, but it claims to have merged in git->hg push support on 7 Dec 2011. As I explain in <a href="https://github.com/dubiousjim/yagh/blob/master/Evaluation.md" rel="nofollow noreferrer">a review of these tools</a>, though, the way this tool tries to implement push support doesn't seem to be workable.</p></li> <li><p>There's also <a href="https://github.com/msysgit/msysgit/wiki/Guide-to-git-remote-hg" rel="nofollow noreferrer"><strong>another project called git-remote-hg</strong></a>. Unlike the version listed above, this one doesn't rely on hg-git, but instead directly accesses the Mercurial Python API. At the moment, using it also requires a patched version of git. I haven't tried this yet.</p></li> <li><p>Finally, <a href="http://progetti.arstecnica.it/tailor" rel="nofollow noreferrer"><strong>Tailor</strong></a> is a project that incrementally converts between a variety of different VCSs. It sounds like development of this won't be aggressively continued.</p></li> </ol> <p>The first three of these approaches looked lightweight enough to persuade me to investigate. I needed to tweak them in some ways to get them to run on my setup, and I saw some ways to tweak them further to improve them, and then I tweaked them still further to make them behave more like each other so that I could evaluate them more effectively. Then I thought others might like to have these tweaks too, to do the same evaluation. So I've <a href="https://github.com/dubiousjim/yagh" rel="nofollow noreferrer">made a source package</a> that will enable you to install my versions of any of the first three tools. It should also take care of installing the needed <code>hg-fast-export</code> pieces. (You need to install <code>hg-git</code> on your own.)</p> <p>I encourage you to try them out and decide for yourself what works best. I'll be glad to hear about cases where these tools break. I'll try to keep them in synch with upstream changes, and to make sure the upstream authors are aware of the tweaks I think are useful.</p> <p>As I mentioned above, in evaluating these tools, I came to the conclusion that <code>git-hg</code> is only usable for pulling from Mercurial, not for pushing.</p> <p>Relatedly, here are some useful comparisons/translation manuals between Git and Mercurial, in some cases targetted at users who already know Git:</p> <ul> <li><a href="https://www.mercurial-scm.org/wiki/GitConcepts" rel="nofollow noreferrer">Mercurial for Git users</a></li> <li><a href="https://stackoverflow.com/questions/1598759/git-and-mercurial-compare-and-contrast">Git and Mercurial - Compare and Contrast</a></li> <li><a href="https://stackoverflow.com/questions/35837/what-is-the-difference-between-mercurial-and-git">What is the difference between Mercurial and Git</a></li> <li><a href="http://alblue.bandlem.com/2011/03/mercurial-and-git-technical-comparison.html" rel="nofollow noreferrer">Mercurial and Git: a technical comparison</a></li> <li><a href="https://github.com/sympy/sympy/wiki/Git-hg-rosetta-stone" rel="nofollow noreferrer">Git hg rosetta stone</a></li> <li><a href="http://quirkygba.blogspot.com/2009/04/mercurial.html" rel="nofollow noreferrer">Homebrew Coding: Mercurial</a></li> <li><a href="http://francisoud.blogspot.com/2010/07/git-vs-mercurial.html" rel="nofollow noreferrer">Francisoud's Blog: Git vs Mercurial (hg)</a></li> <li><a href="http://www.wikivs.com/wiki/Git_vs_Mercurial" rel="nofollow noreferrer">Git vs Mercurial</a></li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload