I'm currently importing an SVN repository into Git. The structure of the SVN repository is a bit messy so I'm having to convert it into three separate Git repositories and then merge them all together.
If these was a simple project with three parts to a single history, then I might just rebase them on top of the other, e.g.:
cd part3
git remote add -f part1 url_to_part1
git remote add -f part2 url_to_part2
git rebase part2/master
git rebase part1/master
However part3
in my example above contains dozens of tags and three branches. If parts 1 and 2 had been cleanly merged into master
(well, trunk) within SVN, then I would do something like this to graft the branch into the history correctly. This has the benefit that all of the tags stay in place, unlike with a rebase.
But one of the branches has an orphaned commit that we would now like to merge into the history. Now if I try to fix the history with the graft, the changes from the orphaned commit are lost. In the example below, the merge X to C happened in SVN and so I can create the link with a graft. But I want to merge the orphaned commit O in between C and D, while preserving the tags on commits E, G etc.
A-B-C-[ ]-D-E-F-G-H-...
\ / /
X--O
Is there a way that I can specify the graph structure using something like the grafts file but then actually execute the implied merges? Or is there a filter-branch command that I should be using here?