Saturday, July 9, 2011

Converting bzr repositories to git

After using Bazaar for some projects and Git for others, I decided to stay on Git, mainly for speed and github.

Here's what I did to convert my bzr repositories to Git, keeping history:

Install bzr-fastimport from your package manager or, if you're not on GNU/Linux, download it from http://wiki.bazaar.canonical.com/BzrFastImport.

Create your new Git repository

Copy the history

Do a checkout to get the files. Git will act like nothing happend, but ls before and after will tell you otherwise

If you used bzr ignore, rename the list so it will be used by Git

You could do a commit to mark the change. If you didn't rename .bzrignore, you'll have to force it:

If this isn't a one-shot conversion and you need to update the Git repository again, you can use marks so only new changes are exported. Read the comments on this page for a short tutorial.

No comments:

Post a Comment