Search code examples
gitsvngit-svn

Migration from SVN various source folders in non standard layout to GIT


Several of the SVN repositories I need to migrate show a very messy layout. Most of them, I figured out how to convert them, but one is bugging me and I don't find an answer on the net.

The SVN repository has this folder strucutre:

/trunk/src
/trunk/doc
/trunk/tools/toolA
/trunk/tools/toolB
/toolX

The question is, how do I get this into GIT master branch like:

/src
/doc
/tools/toolA
/tools/toolB
/tools/toolX

Solution

  • so I'd have to import the project with --trunk / and get a completely flat layout?

    No, it would be better to do a classic import, getting a repository with /trunk/src instead of src in it.

    Then, with a git filter-branch, as shown here (2016) or even here (2011), you can mv/rename those files in order to remove any /trunk/ in their path.

    This is of course valid for one-shot import, not for two-way import/export, where you still want later to git svn dcommit data back to the original SVN repository.