将具有非标准布局的Subversion存储库导入到Git中

将具有非标准布局的Subversion存储库导入到Git中

本文介绍了将具有非标准布局的Subversion存储库导入到Git中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试(永久地)将小组的Subversion存储库迁移到Git,但是在尝试清理其非标准目录结构时遇到了问题.

I'm trying to (permanently) migrate my group's Subversion repository to Git, but I'm running onto problems trying to clean up its non-standard directory structure.

项目的某些内容包含在"trunk"和"branches"文件夹中,但不是全部. Subversion项目的布局如下:

Some of the project's content is contained in trunk and branches folders, but not all of it. The project on Subversion is laid out like this:

project/trunk/
project/branches/feature_1
project/branches/feature_2
project/libraries
project/crontab
...

导入后,我希望这样布置Git存储库:

After importing, I want the Git repository to be laid out like so:

project/html # the content of the old trunk and branches folders
project/libraries
project/crontab
...

运行用适当的选项将正确处理树干和树枝目录,但我怎么也包括对其他文件夹的历史?似乎git-filter-branch可以帮助您,但我不确定如何将其用于此目的.

Running svn2git with the appropriate options will handle the trunk and branches directories correctly, but how can I also include the history for the other folders? It seems like git-filter-branch could help, but I'm not sure how to use it for this.

推荐答案

将存储库的每个主要子文件夹导入单独的git存储库,然后使用子树合并方法,将git存储库合并到一个存储库中.不过,您最终可能会进行一些重复的提交.

Import each main subfolder of your repo into a separate git repo and then use the subtree merging method to merge the git repos into one repo. You may end up with a few duplicate commits though.

如果您有许多子目录,则可能需要执行svnadmin dump,然后svndumpfilter exclude ..两次以将svn存储库分为两半,然后使用子树合并方法将它们重新加入.与进行许多子树合并相比,这将具有更清晰的历史记录.

If you have many subdirectories you may want to do an svnadmin dump, then svndumpfilter exclude .. twice to split your svn repo into two halves and then use the subtree merging method to re-join them. This would have a cleaner history than doing many subtree merges.

这篇关于将具有非标准布局的Subversion存储库导入到Git中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-23 23:32