Skip to content

Instantly share code, notes, and snippets.

@ahdiaz
Created September 21, 2011 10:07
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ahdiaz/1231726 to your computer and use it in GitHub Desktop.
Save ahdiaz/1231726 to your computer and use it in GitHub Desktop.
Import multiple branches from Bazaar to Git
# Requirements
sudo aptitude install bzr-fastimport
# Create an empty Git repository
~/dev:$ mkdir repo.git
~/dev:$ cd repo.git
~/dev/repo.git:$ git init
# Export from Bazaar, import into Git
~/dev/repo.git:$ bzr fast-export --export-marks=marks.bzr ~/dev/repo.bzr/branch_1 | git fast-import --export-marks=marks.git
# Go back to the last state because all files are marked for deletion
~/dev/repo.git:$ git reset --hard HEAD
# If you want to import other branches...
~/dev/repo.git:$ bzr fast-export --import-marks=marks.bzr -b other_branch ~/dev/repo.bzr/branch_2 | git fast-import --import-marks=marks.git
~/dev/repo.git:$ git branch -a
* master
other_branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment