如何将具有自定义结构的 SVN 存储库迁移到 Git?



我在SVN中有一个多模块遗留项目,其中各个模块被单独发布和标记,导致以下结构:

trunk/
project/
moduleX/
moduleY/
moduleZ/
tags/
moduleX-1.0/
moduleX-1.1/
moduleY-0.1/
moduleZ-2.0/

看起来标签是用svn copy trunk/project/moduleX/ tags/moduleX-1.0/等创建的,而不是svn copy trunk/project/ tags/moduleX-1.0

是否可以将此类项目作为单个存储库迁移到 Git,保留历史记录并创建适当的标签?

您需要手动配置 git-svn。

  1. 创建空存储库:git init moduleX ; git init moduleY ; git init moduleZ
  2. 编辑每个 gitconfig 并添加一个 git-svn 部分,如下所示:

moduleX/.git/config:

[svn-remote "svn"]
url = svn://your-server/svn-repo
fetch = trunk/project/moduleX:refs/remotes/svn/trunk
tags = tags/moduleX-*:refs/remotes/svn/tags/*

moduleY/.git/config:

[svn-remote "svn"]
url = svn://your-server/svn-repo
fetch = trunk/project/moduleY:refs/remotes/svn/trunk
tags = tags/moduleY-*:refs/remotes/svn/tags/*

moduleZ/.git/config:

[svn-remote "svn"]
url = svn://your-server/svn-repo
fetch = trunk/project/moduleZ:refs/remotes/svn/trunk
tags = tags/moduleZ-*:refs/remotes/svn/tags/*
  1. >每个副本中git svn fetch

最新更新