简体   繁体   English

将大型SVN存储库迁移到git

[英]Migrating a large SVN repo to git

I have a large SVN repo (around 140GB) that holds many projects and does not follow the svn recommended directory structure. 我有一个大型SVN仓库(大约140GB),它包含许多项目,并且不遵循svn推荐的目录结构。 From all this data (it includes binaries, release builds and dependencies), all I really care about is at an specific path, that actually has a very small history compared to everything else. 从所有这些数据(它包括二进制文件,发布版本和依赖项),我真正关心的是在一条特定的路径上,与其他一切相比,它实际上具有非常小的历史。

All docs I've read so far on SVN-to-Git migration require me to pull the whole SVN repo to Git but this is taking forever, timeouting, going OOM and crashing. 到目前为止我在SVN-to-Git迁移中阅读的所有文档都要求我将整个SVN repo拉到Git,但这需要永远,超时,OOM和崩溃。 Is there any way I can pull only the history for this very specific folder? 有什么方法我只能为这个非常具体的文件夹提取历史记录吗?

Or is there a way I can export the SVN history for this folder alone into a new SVN repo and start the git migration from there? 或者有没有办法可以将此文件夹的SVN历史记录单独导出到新的SVN仓库并从那里开始git迁移?

通过--no-minimize-url,EG,:

git svn clone <SVN_URL>/your/specific/folder --no-minimize-url --no-metadata folder

If you have access to the Subversion repository (not just a working copy), I recommend using svn2git because it will be much faster. 如果您可以访问Subversion存储库(而不仅仅是工作副本),我建议使用svn2git,因为它会快得多。

Your rules file will resemble 您的规则文件将类似于

create repository specific-folder.git
end repository

# note: trailing slash is important
match /trunk/foo/bar/baz/specific-folder/
  repository specific-folder.git
  branch master
end match

# ignore everything else
match /
end match

Then your command will be 那你的命令就是

svn-all-fast-export --identity-map=my-users --rules=specific-folder.rules \
  --stats --add-metadata /full/path/to/subversion/repo

Note that your new git repository will contain the contents of specific-folder . 请注意,您的新git存储库将包含specific-folder内容

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM