简体   繁体   English

为多个git-svn存储库创建一个主git存储库

[英]Create a master git repository for multiple git-svn repositories

I have a project which consists of several services, each in their own SVN repository and a build script that checks out each SVN repository as a folder in a single /project directory along with a /project level Makefile to recursively build the whole project. 我有一个包含多个服务的项目,每个服务都在各自的SVN存储库中,还有一个生成脚本,该脚本将每个SVN存储库作为一个文件夹检出到单个/project目录中,并带有/project级别的Makefile来递归地构建整个项目。

Visually it looks something like this: 看起来像这样:

/project
  Makefile
  /service1    # First service (SVN repository)
    /.svn
  /service2    # Second service (SVN repository)
    /.svn
  ...

I am trying to convert the project into a single shareable git repository to collaborate with teammates on without removing the ability to commit back to the original SVN repositories. 我正在尝试将该项目转换为一个可共享的git存储库,以便与队友进行协作,而又不删除提交回原始SVN存储库的功能。

My current idea is to check out each SVN repository ( /service1 , /service2 , etc.) using git-svn and then create a master git repository at the /project level to group them into a single repository. 我当前的想法是使用git-svn检出每个SVN存储库( /service1/service2等),然后在/project级别创建一个主git存储库,以将它们分组为一个存储库。 The hypothesized project structure would look something like this: 假设的项目结构如下所示:

/project
  /.git      # Master git repository
  Makefile
  /service1    # First service (SVN repository)
    /.git      # .git directory for git-svn checkout of service 1
  /service2    # Second service (SVN repository)
    /.git      # .git directory for git-svn checkout of service 2
  ...

Will this work? 这样行吗? Is there a simpler solution? 有没有更简单的解决方案?

Note: I do not have the authority to redefine the project structure or the structure of the SVN repositories. 注:我没有重新定义项目结构或SVN仓库的结构的权威。

It can work, provided you consider /project as a parent repository referencing the servicexx git repos as submodules . 只要您将/project作为将servicexx git repos作为子模块引用的父存储库,它就可以工作。

That way, other collaborators can reference only the parent repo, and get back all the submodules in it. 这样,其他协作者只能引用父仓库,并取回其中的所有子模块。
As explained in " True Nature of submodules ", they can then create/checkout branches within those submodules and start modifying them. 如“ 子模块的真实本质 ”中所述,然后它们可以在这些子模块中创建/签出分支并开始对其进行修改。

Make sure though than one branch is dedicate for git svn dcommit (merge back to SVN): 确保虽然有多个分支专用于git svn dcommit (合并回SVN):
See " Overcome git svn caveats " and " Easy merging in svn using git-svn ". 请参阅“ 克服git svn注意事项 ”和“ 使用git-svn轻松合并到svn中 ”。

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

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