Skip to content

Instantly share code, notes, and snippets.

@jcefoli
Last active April 19, 2018 14:32
Show Gist options
  • Save jcefoli/e3f5220e4bc083d2bebefb044f379d2c to your computer and use it in GitHub Desktop.
Save jcefoli/e3f5220e4bc083d2bebefb044f379d2c to your computer and use it in GitHub Desktop.
Convert Mercurial (HG) Repositories to Git

Prereqs

Must have mercurial, the hg-git mercurial extension, and git installed

Initiate bare Git repository

git init --bare /path/to/git/repo.git

Push HG dir to Git using hggit extension

cd /path/to/hg/repo

hg bookmark -r default master

hg push /path/to/git/repo

Get code into correct state

cd /path/to/git/repo

git config --path core.worktree /path/to/git/repo

git checkout master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment