a git utility for checking out and tracking a mercurial repos
xj9 0a493388ce frej/fast-export@b51c58d 3 weeks ago
bin git-hg: add missing quotes to path vars 4 months ago
fast-export @ b51c58d3e0 frej/fast-export@b51c58d 3 weeks ago
.gitignore sed might be at /usr/bin/sed instead, stop depending on extended regex. 6 years ago
.gitmodules use new repository for fast-export with fixes for hg 2.9 4 years ago
LICENSE added code, license, readme and script to easily update externals 9 years ago
Makefile frej/fast-export@b51c58d 3 weeks ago
README.markdown fixing markdown error 2 years ago
package.json make bpkg friendly 4 years ago



Description: A set of scripts for checking out and tracking a mercurial project from git. Push supported added as well although it is still experimental.

Author: Cosmin Stejerean (offbytwo)

License: MIT


Mercurial (hg) and python must be installed and in your $PATH.

On Windows, you will also need a copy of Mercurial for Python, available at the Mercurial downloads page

If this is a fresh checkout run

$ git submodule update --init

to pull in fast-export. If for some reason you cannot do this get a copy of fast-export from http://repo.or.cz/w/fast-export.git and place it in the root of the checkout.


Either add /path/to/this/checkout/bin to your $PATH, or symbolic link /path/to/this/checkout/bin/git-hg into a directory on your $PATH.

Alternatively you can execute

    $ make
    $ sudo make install

to install the script and all required fast-export files in /usr/local (you can change the destination by passing eg PREFIX=/usr to both make invocations)


  • Clone an hg repo, including ones over HTTP:

    $ git-hg clone http://some/random/hg/repo [local-git-repo-name]
  • Fetch updates from the hg repo:

    $ git-hg fetch

    or optionally:

    $ git-hg pull # same as git-hg-fetch && git merge hg/branch_name
  • Checkout a new branch from hg:

    $ git-hg checkout branch_name
  • Push changes back to hg, optionally to a specific destination:

    $ git-hg push [destination]


.git/hgcheckout - contains a bare mercurial checkout of the specified repo

.git/hgremote - contains a bare git repo clones from the mercurial one, this

              is added as a remote called "hg" in the base repo