Search code examples
gitsvnmigrationbranchsvn2git

Migrate SVN branches subfolders to Git


I'm using svn2git but I could use git svn as well. I had the scenario below in the SVN repository.

 trunk 
 brances 
     branchesA
         branchA1
         branchA2
         [...]
     branchesB
         branchB1
         branchB2
         [...]
     branchesX
         [...]

After the migration is done, on Git side there are branches branchesA, branchesB, etc... That have inside folders with the properly SVN branches. For example on Git repository:

 master 
 branchesA 
 branchesB 
 branchesX
 [...]

If you $git checkout branchesA you will see all branches sub folders like ($ls):

 branchA1
 branchA2
 branchA3
 [...]

Is there a way or tool or something that could fix this once I already migrated it, or somehow pass more then one folder to the --branches?


Solution

  • Do not use git svn for a one-time conversion. It is gread if you need to constantly sync and also commit back to SVN, but sub-optimal for a one-time conversion.

    There are pleny tools called svn2git, but from your question I'd guess you are not using the KDE one from https://github.com/svn-all-fast-export/svn2git. I strongly recommend using that svn2git tool. It is the best I know available out there and it's very flexible in what you can do with its rules files.

    You will easily be able to configure it for your layout to get the result you want and expect. You can even keep the convention of having your branches in "subfolders" like you have it currently in SVN. A branch in Git would then be branchesA/branchA1.

    If you are not 100% about the history of your repository, svneverever from http://blog.hartwork.org/?p=763 is a great tool to investigate the history of a SVN repository when migrating it to Git.