Convert a bazaar repository into a git one

Yesterday, for a work task, I needed to convert a bazaar repository into a git one, to store code for other teams (that mostly use git) to work on. The bazaar repo was very simple actually, small history and it didn’t contain any merges.

Read The Docs™

Or almost… The first thing I did was heading other bazaar extensive documentation, in particular to its wiki sections on plugins. And there you have it, just an install-command away, ready to work: bzr-fastimport. Yeah, it says import, but it works also on the export part.

The steps I took:

bzr branch repo git-repo
cd git-repo && git init
bzr fast-export `pwd` | git fast-import
rm -rf .bzr

It should work also for fairly complex projects, though I didn’t try it on one.

  • Zygmunt Krynicki

    It works, except when it doesn’t because of outstanding bugs in bzr-fastexport.