Monday, April 14, 2008

Converting Mercurial to git

I tend to forget how to do these one-time operations, so I'm listing it here for reference (taken from the readme).
  1. Grab hg-fast-export from here
  2. Make an empty directory for the new git repository
  3. From this empty directory, run the following commands:
  4. git init
  5. -r "location of mercurial repo"
  6. git reset --hard

If you're lazy like me, you can copy the files in hg-fast-export over to the new directory, run and then delete them afterwards (before step 6).

So far, it seems to be a very clean transition, all commits are in place. Of course, the repository is very small with no branches so no issue was expected.

Oh yeah, Mercurial and Git are distributed version control systems which greatly lessen the dependency on the old subversion client-server model. As to which one is better, I'm totally not qualified to make any judgement, but git does take 3 letters to type, while hg takes just 2. :)

No comments: