Moving from BZR to GIT

Seeing as Drupal.org is moving to git soon, I figured I would switch from bzr to git too. I still use SVN for some clients, but all my own stuff was under bzr.

I didn't want to lose my commit history, so I searched around and eventually found a way to convert it to git. I am on Windows 7, so I installed cygwin 1.7.7 to get a linux commandline. During installation I selected both bzr and git.

  • Afterwards I went into cygwin, and changed to the C:\cygwin\lib\python2.6\site-packages\bzrlib\plugins\ directory.
  • From there I ran bzr branch lp:bzr-fastimport/0.6, which downloaded the fastimport (and fast-export) plugin.
  • I renamed the created 0.6 folder to fastimport.
  • I changed to the folder where my bzr repo was sitting and ran the following commands:
  • $ alias bzrexp="/lib/python2.6/site-packages/bzrlib/plugins/fastimport/exporters/bzr-fast-export.py"
  • $ git init
  • $ bzrexp branch_name | git fast-import
  • $ git reset HEAD
  • I deleted the .bzr folder and that was it.
Posted in:

On current Ubuntu, you can

On current Ubuntu, you can just install it with sudo apt-get install bzr-fastimport

And I did git reset HEAD --hard since I created the .git in another dir, but I think you should be fine when you do not change the directory.

magnanimous-junior