[Kde-scm-interest] conversion howto: importing subproject history

Oswald Buddenhagen ossi at kde.org
Sun Nov 28 00:36:38 CET 2010


moin,

just read this question on irc, and i suppose more people run into it:
a subproject has been developed in a separate subtree and was later
moved into the project which is being converted now. a straight history
is obviously not able to represent that. the solution:

- convert the history of the subproject separately up to the point where
  it moves into the main project
- make an interactive rebase of the main project and make it stop at the
  commit where the subproject moves into it (mark the commit for edit,
  obviously)
- note that sha1, then throw the commit away with reset --hard HEAD~1
- git remote add -f subproject1 /path/to/subproject1
- git merge -s ours --no-commit subproject1/master
- git cherry-pick <remembered sha1>
- git rebase --continue

this is a variation of a subtree merge - see
http://www.kernel.org/pub/software/scm/git/docs/howto/using-merge-subtree.html
(you'll need that for later subproject merges anyway, so read it ;).

the rebasing will take ages for a big project, so mark all subproject
moves in one go in the rebase editor.

this is all theory, as i haven't actually tried it. can't be too far
off, though. please report your results or better ideas.


More information about the Kde-scm-interest mailing list