Search code examples
gitsvngit-svn

Migrating from SVN multi-repo to GIT


I'm total newbie in git-svn bridge and faced a task to migrate from SVN repo to GIT. SVN structure looks really terribly:

root
  base
    server
      core
         branch
         tags
         trunk
      webapp
         branch
         tags
         trunk
       ....
    client
      core
         branch
         tags
         trunk
      ....
    ....
  ....

As a "talented svn migrate-master", I executed git svn clone ..../root and cloned the whole repository. I have no branches visible to GIT:

$ git branch -a * master remotes/git-svn

I can easily navigate to root-base-server-core-branch-my-awesome-branch and it looks like regular folder.

How to continue svn2git conversation? Looks like I should start from scratch but cloning this evil took one week and I don't want to wait again...


Solution

  • You have multiple svn projects in that repo. Do you want to combine them in git? You may want to look into making a separate git repository for client, core and webapp.

    Look into git svn clone's --branches, it can take multiple wildcards, which you may need with that terrible svn structure. Something like --branches=*/*/*/*/branch/*

    You can also use multiple --branches as in --branches=coked/out/path/branch/* --branches=totally/messed/up/path/branches/*

    From the help:

           -T<trunk_subdir>, --trunk=<trunk_subdir>, -t<tags_subdir>, --tags=<tags_subdir>, -b<branches_subdir>,
           --branches=<branches_subdir>, -s, --stdlayout
               These are optional command-line options for init. Each of these flags can point to a relative repository path
               (--tags=project/tags) or a full url (--tags=https://foo.org/project/tags). You can specify more than one --tags and/or
               --branches options, in case your Subversion repository places tags or branches under multiple paths. The option
               --stdlayout is a shorthand way of setting trunk,tags,branches as the relative paths, which is the Subversion default. If
               any of the other options are given as well, they take precedence.