a guide for sceptic's
It's easy they said. Distributed SCMs are all basically the same they said, so transitioning from one to the other is super easy. So easy that in the time it's taken to write this sentence, you should have already installed a plugin and pushed your mercurial repo up to github right?
The mercurial to git conversion is nothing short of a pain. Documentation is spotty and full of that peculiarly glib variety of optimism found most often at fast food eateries and VC-funded startups. But you know that already. That's why you're here after all.
no. you can escape the plastic land of hg and enter the land of gritty git goodness.
It isn't simple, but it is pretty easy. First, just so we're all on the same page here, you'll need an hg repo and an empty github repo. You'll also need to install the hg-git extension to mercurial. Don't worry, it's super easy.
First, fire up a terminal and cd
into your hg repo. You shouldn't need to cd
anywhere else, so bring a sandwich. We'll be here for a minute or two. After you've had your snack, load up .hg/hgrc and make sure it has something like this tucked neatly inside:
[paths]
origin = git+ssh://[email protected]/joechrysler/repo.git
Back to the terminal now, run
hg branches | sed 's/\(\w*\).*:\(\w*\).*/\2 \1/' >> .hg/bookmarks
to add a bookmark for every branch in hg (not just master). You might also want to open up .hg/bookmarks in an editor and change default
to master
to better fit the git idiom. For this step you'll need to have turned on the hg bookmarks extension.
Almost there now. From now we need to clean up any git nonsense that might be sitting around with hg gc
. Push it up to github with hg push origin
, and you're done! You're processor and nic, however, will be chugging on the commits for a while, so it's probably a good time to grab another of those sandwiches.
you now have a full copy of your hg repository on github!
I also had lots of pain the hg-git extension way. But I definitely succeeded the fast-export Python tool way. If you or anyone is interested, have a look:
https://gist.github.com/HerrPi/5ad9a2cd68163483fc3e23801caa5086