将SVN分支子文件夹迁移到Git

时间:2016-04-25 08:04:22

标签: git svn migration branch svn2git

我使用svn2git但我也可以使用git svn。我在SVN存储库中有以下场景。

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

迁移完成后,在Git端有分支branchesAbranchesB等等......内部文件夹中有正确的SVN分支。例如,在Git存储库:

 master 
 branchesA 
 branchesB 
 branchesX
 [...]

如果您$git checkout branchesA,您会看到所有分支子文件夹($ls):

 branchA1
 branchA2
 branchA3
 [...]

有一种方法或工具可以在我迁移它之后解决这个问题,或者以某种方式将多个文件夹传递给--branches吗?

1 个答案:

答案 0 :(得分:1)

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.