Reputation: 161
I have searched a solution for weeks, but I wasn't lucky.
I have a bazaar repo with 5 years of history (up to 2011). When I started working on this project (2011), I was using svn, so the "manager" just gave me a tarball with the sources of the "master" (it has been impossibile to convert the project in svn). I set up an svn repo from that tarball and I worked on it until last month. I switched to git recently, converting both the svn and git repos in two git repos.
Now I have two git repositories: the former bzr repo, covering 2006-2011, and my repo, covering 2011-2016. What I would like to do is to have a linear history on the master, i.e. I would like to put my master (with attached branches) "on top" of the former bzr repo.
Is it possible?
Upvotes: 0
Views: 70
Reputation: 213508
Yes, this is possible.
First, convert the bzr repo to git. You will have two repos, let's call them proj-bzr and proj-git.
In proj-git, add proj-bzr as a remote, and fetch it. Hopefully, the last commit of proj-bzr and the first commit of proj-git have the same files.
Add a graft which sets the latest proj-bzr commit as a parent to the oldest proj-git commit. See: https://git.wiki.kernel.org/index.php/GraftPoint
Once you are convinced that this is the correct history, you can use filter-branch to "bake" the graft into the repository and make it permanent. This will rewrite all of the SHA-1 hashes of proj-git.
Upvotes: 1