Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Svn -> git migration with several trunk/branches/tags

Tags:

git

svn

git-svn

I have a single SVN repository with the following current structure:

  • project1
    • branches
    • trunk
    • tags
  • project2
    • branches
    • trunk
    • tags

which originally had this structure:

  • project
    • branches
    • trunk
      • proj1
      • proj2
    • tags

That is, the project was split into two separate "subrepositories" (or whatever you want to call that)

Is there any way to migrate this to git without losing history? Would svn2git be better that git-svn for this scenario? Is there any other migration tool?

EDIT: I tried git svn clone as suggested but, as I thought, it didn't follow the move from the old structure to the new one. It only imported the revisions from the new structure.

like image 353
Mauricio Scheffer Avatar asked Oct 15 '22 13:10

Mauricio Scheffer


2 Answers

First I converted the main trunk to git:

git svn clone url-to-project -s

Then I converted each project:

git svn clone url-to-project1 -s
git svn clone url-to-project2 -s
...

Then for each project I attached the previous history from the main trunk using grafts and filter-branch.

I just blogged about it.

like image 57
Mauricio Scheffer Avatar answered Oct 17 '22 14:10

Mauricio Scheffer


svn2git just uses "git svn" underneath, so it won't be "better" per se. It just makes nice tags and branches and cleans things up for a clean break from svn. If that's what you want, I'd go ahead and use it on the two sub-repositories individually. It will get all of the appropriate history.

like image 44
ebneter Avatar answered Oct 17 '22 12:10

ebneter