Search code examples
gitsvnbazaar

How can I join consecutive SVN and BZR repos into GIT?


A strange request, I admit...

We have a project that is currently managed in Bazaar, but was previously stored in Subversion. However, rather that copying the history across, the previous developers took a single export of the SVN repo and started a brand-new BZR repo.

Thus, we have the following:

SVN: A-B-C-D
BZR: E-F-G-H

And what I want is:

GIT: A-B-C-D-E-D-G-H

Thanks


Solution

  • Probably easiest with git filter-branch. In fact, this is one of the examples in the filter-branch documentation:

    To set a commit (which typically is at the tip of another history) to be the parent of the current initial commit, in order to paste the other history behind the current history:

           git filter-branch --parent-filter 'sed "s/^\$/-p <graft-id>/"' HEAD
    

    So here <graft-id> is your commit D, assuming you are working from a branch consisting of the BZR commits E to H. So I assume you've used migration tools to get both the svn and bzr histories into git, and imported them as separate branches into a single repository.