具有多个主分支的 Gitflow [英] Gitflow with multiple master branches

查看:63
本文介绍了具有多个主分支的 Gitflow的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

虽然这类似于线程 Git-flow 和具有多个并行发布分支的主控在多个 master 分支上使用 git 的最佳方法是什么?,它并不完全相同......我确实发现这个相当相似:多个项目具有相同的 GIT master,但我想讨论我的具体用例...

While this is similar to the thread Git-flow and master with multiple parallel release-branches and to What's best way to work with git on multiple master branch?, it is not quite identical... I did find this one is rather similiar: Multiple projects with same GIT master, but I want discuss my specific use case...

我工作的公司正在为我们的 Git 工作流程制定政策和程序.我们想使用文章 http://中描述的Gitflow"模型nvie.com/posts/a-successful-git-branching-model/https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow 并且在有关该问题的许多讨论中经常被引用.

The company I work for is in the process establishing policies and procedures for our Git work flow. We want to use the "Gitflow" model as described in the article http://nvie.com/posts/a-successful-git-branching-model/ or https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow and is commonly referenced in many discussions on the matter.

但是,我们有一个用例,但我找不到解决方案记录的需求.如果您的项目用于生产不止一种最终产品怎么办?因此,主分支不能将发布点"表示为一个单一产品.似乎主人可能需要备用分支?多个并行发布分支?

We have a use case, however, with a requirement for which I cannot find a solution documented. What if your project is used to produce more than one final product? The master branch cannot therefore represent the "release points" as if it were one single product. It seems that perhaps alternate branches are required from the master? So multiple parallel release branches?

例如,如果项目充当某些可能具有不同外观、风格或变体的东西的支柱或引擎,但您希望将每个完整的最终产品存储在一个存储库中,该怎么办?

For instance, what if the project acts as a backbone or engine to something that can have different skins, flavours, or variations but you want to have each of the full resulting final products stored in one repository?

在我的特定场景中,我有一个在 Linux 服务器上运行的程序,但它也作为本地 Windows 应用程序分发.在这些不同的版本中,有很大一部分项目可能包含在一个或另一个版本中,也可能不包含.例如,如果 repo 仅用于服务器,则服务器上的库不需要包含在内,但必须包含在本地分发中,否则它们将不存在.我想在特定的发布点将 repo 的更新拉到服务器上,但省略不属于那里的部分.

In my particular scenario, I have a program which runs on a Linux server, but it is also distributed as a local Windows application. In these differing versions, there are large chunks of the project which may or may not be included in one or the other releases. As an example, there are libraries on the server which do not need to be included if the repo was for the server only, but which must be included for the local distribution where they would not otherwise exist. I want to pull updates to the repo onto the server at specific release points, but omit such pieces that don't belong there.

从 master 分支,我会创建一个服务器发布"和本地发布"分支吗?

From the master branch, would I create a "Server Release" and "Local Release" branch?

开发分支(及其功能)会从哪里脱离?我不想要多个开发分支,每个分支都来自它自己的版本,因为代码开发实际上 99% 适用于这两个分支.我是否需要将单个 dev 分支合并为一个,然后再合并另一个版本?

Where would the development branch (and it's features) then come off of? I don't want multiple development branches, each coming from it's own release, as the code developments are in fact 99% applicable to both of those. Do I need to merge a single dev branch into one and then the other release?

推荐答案

如果 99% 的代码在两个产品之间共享,您就可以轻松共享同一个存储库.只要两个产品处于相同的发布周期,例如 2.0 版同时发布,您就可以有一个单独的发布/开发/主分支.

If 99% of the code is shared between the two products, you could easily share the same repository. You can have a single release/develop/master branch as long as the two products are on the same release cycle e.g., version 2.0 ships at the same time.

从 master 分支,我会创建一个服务器发布"和本地发布"分支吗?

From the master branch, would I create a "Server Release" and "Local Release" branch?

在 gitflow 中,您实际上是从开发分支发布!但是如果它们处于不同的发布周期,则没有什么可以阻止您为每个产品创建一个发布分支.然后你可以自由地将发布分支合并到开发和主分支,当它们在自己的时间完成时.这里唯一的事情是您可能需要在主分支上有两种不同风格的标签,以便您可以看到每个产品在其发布周期中的位置.或者为了保持标签格式相同,您可能有两个主分支(每个产品一个),当相应产品的功能完成时,您可以将它们分别合并.

In gitflow you actually branch releases from develop! But in the case that they are on different release cycles, there's nothing stopping you from creating a release branch per product. Then you are free to merge the release branches in to the develop and master branches when they are done on their own time. The only thing here is that you will likely need to have two different flavors of tags on the master branch so that you can see where each product is on its release cycle. Or to keep the tags in the same format, you may have two master branches (one per product), which you merge into respectively when a feature is completed for the respective product.

这篇关于具有多个主分支的 Gitflow的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆