A while back, I decided I wanted to switch one of my projects to a public repository. Something with a bug-tracker, a comment system, and that kind of stuff. I also wanted to use a distributed version control system to make myself learn these new beasts. I was torn between git and bazaar. Then I ran into Brian Aker‘s post on forking Drizzle: http://krow.livejournal.com/602409.html. The point was not to get focused on if git or bazaar was better; but on the surrounding infrastructure. So I put two of my projects on LaunchPad: matlab-bgl and libbvg.
Turns out he was right about the infrastructure. It’s just that LaunchPad is a really bad infrastructure for a tool developed by mostly one person. I realized that I just wasn’t pushing changes to these projects because launchpad was always really slow, and I didn’t really need any of its features.
However, I’ve frequently been using my GitHub repositories. And so, a few years in, I wanted to port my repositories to GitHub instead.
Wow! Was this much easier than I expected.
At first, I thought it’d be a nightmare. If you search for “converting bazaar to git” you’ll get some pages with nasty tailor configurations. For example:
After trying those techniques, I realized it didn’t port my branches at all. Yuck, I want those branches! After reading about how to convert branches, I found this link:
That link was wickly simple compared to the stuff using tailor. Within minutes I had git repositories up with all branches intact! A few notes: you don’t have to install fast-export via the plugin mechanism anymore. Ubuntu has it built in.
sudo apt-get install bzr-fastexport alias bzrexp="bzr fast-export" mkdir matlab-bgl.git cd matlab-bgl.git git init --bare bzrexp --export-marks=../marks.bzr ~/dev/matlab-bgl/master \ | git fast-import --export-marks=../marks.git bzrexp --marks=../marks.bzr --git-branch=4.0 \ ~/dev/matlab-bgl/4.0 | git fast-import \ --import-marks=../marks.git --export-marks=../marks.git bzrexp --marks=../marks.bzr --git-branch=4.0-octave \ ~/dev/matlab-bgl/4.0-octave | git fast-import \ --import-marks=../marks.git --export-marks=../marks.git bzrexp --marks=../marks.bzr --git-branch=work \ ~/dev/matlab-bgl/work| git fast-import \ --import-marks=../marks.git --export-marks=../marks.git git remote add <github repo location> git push --all # push all branches
It turns out searching for “convert bzr to git” is much more fruitful than “convert bazaar to git”. Hence, I’m naming this post “convert bazaar to git”
Now both of the projects are happily hosted on github with their history and branches intact!