简体   繁体   English

在Git中管理多项目分支

[英]Managing Multi-Project Branches in Git

Are there tools to achieve the following abstract operations in a Maven project/SCM scenario? 是否有工具在Maven项目/ SCM场景中实现以下抽象操作?

  • Given an application project, create branches for the application and all the snapshot libraries that it uses, transitively; 给定应用程序项目,为应用程序及其使用的所有快照库创建分支,可传递; these branches should be manageable as one logical branch (see next) 这些分支应该是可管理的一个逻辑分支(见下)
  • Given the logical branch of an application project, release it (by running Maven release); 给定应用程序项目的逻辑分支,释放它(通过运行Maven发布); this means releasing multiple branches, one per library 这意味着释放多个分支,每个库一个

Background (original): 背景(原创):

As you know, Git recommends using the repository-per-project structuring paradigm. 如您所知,Git建议使用每个项目的存储库结构范例。 At the same time, any serious project, in our case Maven-based, is attached to several in-house libraries. 与此同时,在我们的Maven案例中,任何严肃的项目都附属于几个内部图书馆。 During any sprint, both the project and the libraries that it is attached to are modified. 在任何sprint期间,项目和它所附加的库都会被修改。 In a Git world, this means that modifications will exist across several Git repositories. 在Git世界中,这意味着将在多个Git存储库中存在修改。

If we wanted to branch out the work in the sprint, perhaps because we use Gitflow, which invites that we create a release branch at the end of our sprint, how would we do it in a logical manner across all the libraries involved in the sprint, instead of manually branching each library? 如果我们想在sprint中分支出来的工作,也许是因为我们使用Gitflow,它邀请我们在sprint结束时创建一个发布分支,我们将如何在sprint中涉及的所有库中以逻辑方式执行它而不是手动分支每个库?

A Maven-aware tool (one that can introspect the POMs to figure out the transitive snapshot dependency list) will be even better. Maven感知工具(可以反省POM以找出传递快照依赖列表的工具)会更好。

Can I create a logical relationship between my multiple physical branches (one per project) that represent my one logical branch? 我可以在代表我的一个逻辑分支的多个物理分支(每个项目一个)之间创建逻辑关系吗?

Does Git, or some Git tool, support logical branches? Git或Git工具是否支持逻辑分支?

I'm hoping you're not going to say submodules. 我希望你不要说子模块。 What I'm looking for here is to abstract out the details of the VCS, not to become a Git guru. 我在这里寻找的是抽象出VCS的细节,而不是成为Git大师。 Also, I'm looking to do things in one operation where possible, as having to individually branch each library is error prone and easily forgotten. 此外,我希望尽可能在一个操作中执行操作,因为必须单独分支每个库容易出错且容易被遗忘。

Setup a Jenkins server. 设置Jenkins服务器。

It can build each maven module as a separate project and then automatically rebuild any other projects that has a snapshot dependency relationship. 它可以将每个maven模块构建为单独的项目,然后自动重建具有快照依赖关系的任何其他项目。

Update 更新

The GIT plugin for Jenkins has a feature for managing the automatic merging of development feature branches into a "master" or "integration" branch. Jenkins的GIT插件具有管理开发功能分支自动合并为“主”或“集成”分支的功能。 See the documentation: 查看文档:

https://wiki.jenkins-ci.org/display/JENKINS/Git+Plugin#GitPlugin-AdvancedFeatures https://wiki.jenkins-ci.org/display/JENKINS/Git+Plugin#GitPlugin-AdvancedFeatures

Another option is to control feature development using a code review tool like Gerrit . 另一种选择是使用像Gerrit这样的代码审查工具来控制功能开发。 Again it's Gerrit that controls changes integrated onto the shared code stream and Gerrit can be integrated with Jenkins to ensuring all submitted change-sets pass the code tests. 同样,Gerrit控制集成到共享代码流中的更改,Gerrit可以与Jenkins集成,以确保所有提交的更改集都通过代码测试。

Finally releases are cut using the M2 Release plugin , which is a wrapper around the standard release plugin. 最后,使用M2 Release插件剪切版本 ,这是标准版本插件的包装。 (Means you'll always have two types of build in Jenkins. Automated builds triggered by code commits and release builds explicitly triggered via the UI). (意味着你在Jenkins中总会有两种类型的构建。由代码提交触发的自动构建和通过UI显式触发的发布构建)。

Look what I found looking for something else about Gitflow: https://github.com/nvie/gitflow 看看我发现了寻找Gitflow的其他东西: https//github.com/nvie/gitflow

It doesn't work with Maven, so it doesn't fit my needs, but maybe it helps you. 它不适用于Maven,因此它不符合我的需求,但也许它可以帮助你。

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

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