从非标准布局的 SVN 各种源文件夹迁移到 GIT

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

我需要迁移的几个 SVN 存储库的布局非常混乱。其中大部分,我想出了如何转换它们,但有一个困扰着我,我在网上找不到答案。

SVN 存储库具有以下文件夹结构:

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

问题是,我如何将其放入 GIT master 分支,例如:

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

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

不,最好进行经典导入,获取包含 /trunk/src 而不是 src 的存储库。

然后,使用 git filter-branch, as (2016) or even here (2011),您可以 mv/rename 这些文件以删除其路径中的任何 /trunk/

这当然适用于一次性导入,不适用于双向import/export,稍后您仍然希望git svn dcommit将数据返回到原始 SVN 存储库。