{"thread":{"id":"23137","subject":"Migrating from SVN","startedAt":"2010-03-22T10:18:18Z","lastAt":"2010-03-26T11:15:58Z","messageCount":3,"participants":["Christoph Bartoschek","Heiko Voigt"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"137533","messageId":"aosj77-m7e.ln1@burns.bruehl.pontohonk.de","threadId":"23137","inReplyTo":null,"subject":"Migrating from SVN","fromName":"Christoph Bartoschek","fromEmail":"bartoschek@gmx.de","sentAt":"2010-03-22T10:18:18Z","receivedAt":"2010-03-22T10:18:18Z","isPatch":false,"sender":{"key":"bartoschek@gmx.de","avatar":null},"body":"Hi,\n\nwe consider migrating from Subversion to Git. However we are not sure how to \ncleanly migrate the history from Subversion to Git. Till now we have such a \nstructure in a single Subversion repository:\n\nproject_A\nproject_B\nproject_C\nproject_D\nproject_E\n\nVia svn:externals we form two products:\n\nproduct_1/project_A\n          project_B\n          project_C\n\nproduct_2/project_B\n          project_C\n          project_D\n          project_E\n\nNow we are merging both products into one such that the structure should be \n\nproduct/project_A\n        project_B\n        project_C\n        project_D\n        project_E\n\nI think this makes migration to Git easier as we can now work with only one \nGit repository. We also circumvent the usage of the unmature submodule \nsupport in Git.\n\nHow can I now import our Subversion projects into the Git repository such \nthat for each project the history is kept and ideally the whole history is \nlinearized by the subversion revision numbers?\n\nThanks\nChristoph\n"},{"id":"137784","messageId":"20100325062214.GA1829@book.hvoigt.net","threadId":"23137","inReplyTo":"aosj77-m7e.ln1@burns.bruehl.pontohonk.de","subject":"Re: Migrating from SVN","fromName":"Heiko Voigt","fromEmail":"hvoigt@hvoigt.net","sentAt":"2010-03-25T06:22:14Z","receivedAt":"2010-03-25T06:22:14Z","isPatch":false,"sender":{"key":"hvoigt@hvoigt.net","avatar":"https://avatars.githubusercontent.com/u/184958?v=4"},"body":"On Mon, Mar 22, 2010 at 11:18:18AM +0100, Christoph Bartoschek wrote:\n> Now we are merging both products into one such that the structure should be \n> \n> product/project_A\n>         project_B\n>         project_C\n>         project_D\n>         project_E\n> \n> I think this makes migration to Git easier as we can now work with only one \n> Git repository. We also circumvent the usage of the unmature submodule \n> support in Git.\n> \n> How can I now import our Subversion projects into the Git repository such \n> that for each project the history is kept and ideally the whole history is \n> linearized by the subversion revision numbers?\n\nImport them all seperately into git (e.g. using git svn) and then have a\nlook at subtree merge\n\nhttp://www.kernel.org/pub/software/scm/git/docs/howto/using-merge-subtree.html\n\nto merge them all together. That way you will have seperate lines of\nhistory for each project and one (or five) big merges on top.\n\nAFAIK the revision number from svn is stored in the commit message if\nyou use git svn so to add the project name you might want to use git\nfilter-branch to add that name to each commit before merging the history\nlines.\n\nThat way you will have all the history of the now seperate projects in\none git repository. Keep in mind that after doing that its not that easy\nto make them seperate projects again.\n\nHope that helps.\n\ncheers Heiko\n"},{"id":"137839","messageId":"fkhu77-7hm.ln1@burns.bruehl.pontohonk.de","threadId":"23137","inReplyTo":"20100325062214.GA1829@book.hvoigt.net","subject":"Re: Migrating from SVN","fromName":"Christoph Bartoschek","fromEmail":"bartoschek@gmx.de","sentAt":"2010-03-26T11:15:58Z","receivedAt":"2010-03-26T11:15:58Z","isPatch":false,"sender":{"key":"bartoschek@gmx.de","avatar":null},"body":"Heiko Voigt wrote:\n\n> Import them all seperately into git (e.g. using git svn) and then have a\n> look at subtree merge\n> \n> http://www.kernel.org/pub/software/scm/git/docs/howto/using-merge-\nsubtree.html\n> \n> to merge them all together. That way you will have seperate lines of\n> history for each project and one (or five) big merges on top.\n> \n> AFAIK the revision number from svn is stored in the commit message if\n> you use git svn so to add the project name you might want to use git\n> filter-branch to add that name to each commit before merging the history\n> lines.\n> \n> That way you will have all the history of the now seperate projects in\n> one git repository. Keep in mind that after doing that its not that easy\n> to make them seperate projects again.\n\nThanks for your suggestion. Unfortunately I do not want to have separate \nlines of history. \n\nFor example if the subversion revisions are like this:\n\nrev 0: Initial import\nrev 1: Change in project_A\nrev 2: Change in project_B\nrev 3: Change in project_A\nrev 4: Change in project_C\n\nThen I would like to have in git for the product_1 line:\n\nFirst commit: The commit consists of the initial import.\n\nSecond commit: The commit consists of rev 1 of project_A and rev 0 of \nproject_B and rev 0 of project_C.\n\nThird commit: The commit consists of rev 1 of project_A and rev 2 of \nproject_B and rev 0 of project_C\n\nFourth commit: The commit consists of rev 3 of project_A and rev 2 of \nproject_B and rev 0 of project_C.\n\nFifth commit: The commit consists of rev 3 of project_A and rev 2 of \nproject_B and rev 4 of project_C.\n\nThis does not yet include branches. But how can I get a history like that in \ngit?\n\nA similar line of history would appear for product_2 and when they are \nmerged, I can use a subtree merge as sugested to combine them. \n\nChristoph\n"}]}