简体   繁体   English

将复杂的SVN存储库迁移到GIT

[英]Migrating complex SVN repository to GIT

I have a SVN Repository with more than 100 projects and I want to migrate to GIT now. 我有一个包含100多个项目的SVN存储库,现在我想迁移到GIT。 This is how the SVN Repository looks like: SVN存储库如下所示:

customer_1/prj_1 (trunk, branches, tags)
customer_1/prj_2 (trunk, branches, tags)
customer_1/prj_n (trunk, branches, tags)
...
customer_2/prj_1 (trunk, branches, tags)
customer_2/prj_2 (trunk, branches, tags)
customer_2/prj_n (trunk, branches, tags)
...
customer_n/prj_1 (trunk, branches, tags)
customer_n/prj_2 (trunk, branches, tags)
customer_n/prj_n (trunk, branches, tags)

Via SVN I can checkout: 通过SVN,我可以结帐:

  1. The entire repository containing all customers and all projects 包含所有客户和所有项目的整个存储库
  2. All projects of a single customer 单个客户的所有项目
  3. A specific customer's project 特定客户的项目

I still need these three ways of access using GIT, especially branching and tagging single customer projects and not only the entire repository. 我仍然需要使用GIT的这三种访问方式,尤其是分支和标记单个客户项目,而不仅仅是整个存储库。 So basically in SVN different customer projects have different stable releases being stored in the "tags" directory for each project. 因此,基本上在SVN中,不同的客户项目在每个项目的“ tags”目录中存储着不同的稳定版本。 I need to differentiate between customer project releases in GIT as well. 我还需要区分GIT中的客户项目版本。

I have converted the SVN Repository to a single GIT Repository (using svn-git), but as (I think) GIT does not allow to clone single folders like Subversion, it needs to be structured now by using submodules or subtrees. 我已经将SVN信息库转换为单个GIT信息库(使用svn-git),但是由于(我认为)GIT不允许克隆像Subversion这样的单个文件夹,因此现在需要使用子模块或子树来对其进行结构化。

Is it necessary to create a single GIT repository for every single customer project (which would take a lot of time) or what is the most common way to achieve what I was asking for? 是否有必要为每个客户项目创建一个单独的GIT存储库(这会花费很多时间),或者实现我所要求的最常用方法是什么?

If you need to tag individual customer projects, then you need one git repository per project. 如果需要标记单个客户项目,则每个项目需要一个git存储库。 Tags (and branches) in git are global to their repository, there is no way to tag a subdirectory. git中的标记(和分支)是其存储库的全局标记,无法标记子目录。

To do this using git-svn , run 为此,使用git-svn ,运行

git svn clone -s http://svn-repo/customer_1/prj_1 
git svn clone -s http://svn-repo/customer_1/prj_2

etc. 等等

This may indeed take a while, but you'll probably have to live with that. 这确实可能需要一段时间,但您可能必须忍受这一点。 You would of course script the calls to git-svn. 您当然可以编写对git-svn的调用的脚本。

As to browsing the repositories: 关于浏览存储库:

If you have multiple git repos, you can just check them out as subfolders in one folder. 如果您有多个git repos,则可以将它们作为子文件夹检出到一个文件夹中。 If you want to browse them on the server, without cloning/checking out, you will need to install a git repository browser. 如果要在服务器上浏览它们而不克隆/签出,则需要安装git仓库浏览器。 There are many available - there's a list in the git wiki: Interfaces, frontends, and tools . 有很多可用的-git wiki中有一个列表: 接口,前端和工具

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

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