A Bazaar fork in Git

No, not a bizarre forkin' git!

I wanted to fork a package so that I could use it myself but it was hosted on Launchpad in a Bazaar repository whereas I like to use Git and Github.

It is easy to make a Git repository from a Bazaar one. Here's how.

First, install Bazaar and the necessary import/export tool:

$ sudo pacman -S bzr bzr-fastimport

Now, the conversion:

$ cd working-directory
$ bzr branch lp:my-repo
$ cd my-repo
$ git init
$ bzr fast-export --plain . | git fast-import
$ git checkout -f master # will say "Already on 'master'"
$ rm -rf .bzr

That's it: a Git repository with the full revision history, as you can see:

$ git status
On branch master
nothing to commit, working directory clean   

For a quick view of the commit log:

$ git log --pretty=format:'%h %ad %s (%an)' --date=short

This got the master branch (which was the only one in my case) but a little more work is necessary if there are multiple branches. See