Hg to Git with no hassles

zer0pants

Mike Roberts

Posted on April 17, 2020

Hg to Git with no hassles

I got you.

Easy conversion

Step 1: Import your repository to Github

If you're happy to switch to Github, congrats, you're done.

Step 2: Import your newly converted repo into Bitbucket

When you've done this, all of your existing author records will be the same as they were before. This is warts and all. One upside to using frej/fast-export is the opportunity to clean things up a little bit.

Gotchas

  • Github won't keep your closed branches around. For some this will be a blessing. Others not so much.
  • If you import to Github and stop there you may need to do some manual work to attribute your repo authors to Github users. You can do this at any time though and it's simple to do. Here's the docs.
  • There is no bulk UI import tool - this is one at a time, baby.
  • If you use 2FA on Github you may need to generate a personal access token in place of your Github password.
  • But what about comments on commits in Bitbucket / pull requests? They won't travel with you but Rarified has got you covered. See their scripts here to backup metadata from Bitbucket.
  • Disclaimer: Every repository has a history and some will be cleaner than others. As such your mileage with this method may vary. I do recommend trialling both and deciding which is best for you.

Good luck and let me know how you go!
Mike

💖 💪 🙅 🚩
zer0pants
Mike Roberts

Posted on April 17, 2020

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

Hg to Git with no hassles
mercurial Hg to Git with no hassles

April 17, 2020