GitHub Flow 和 GitLab Flow 有什么区别?
What is the difference between GitHub Flow and GitLab Flow?
最近我在 GIT 中发现了工作流的三个概念:GitFlow、GitHub Flow 和 GitLab Flow。我已经阅读了 the nice articles,但我不太了解 GitLab Flow。可能是因为我不是母语人士:)
简要。
GitFlow
我们有一个主分支作为生产分支。我们还有一个开发分支,每个开发人员都在这里合并他的功能。有时我们会创建一个发布分支来在生产环境中部署我们的特性。如果我们在发布分支中有错误,请修复它并将更改拉入开发分支。如果我们在生产中有一个严重的错误,创建新的 hotfix-branch,修复错误并将分支与生产(master)和开发分支合并。
如果我们很少发布我们的工作结果,这种方法很有效。 (也许每 2 周一次)。
GitHub流量
我们有一个 master 分支作为生产分支。我们(作为开发人员)可以创建用于添加新功能或修复错误的分支,并将它们与生产(主)分支合并。听起来很简单。这种方式适合一天部署多次生产分支的极端编程。
GitLab 流程
我见过新术语,例如 pre-production、生产、发布(稳定)分支和暂存环境、pre-production 环境、生产环境。他们之间有什么关系?
我是这样理解的:如果我们需要添加新功能,我们会从 master 分支部署一个 pre-production 分支。完成功能后,我们从 pre-production 分支部署一个生产分支。 pre-production 分支是中间阶段。然后 master 分支从 production 分支中拉取所有更改。
如果我们想查看每个单独的功能,这种方法很好;我们只是在分行结帐我们需要看的东西。
但是如果我们需要展示我们的工作,我们会尽可能晚地创建一个带有标签的发布分支。如果稍后我们修复 master 分支中的错误,我们需要将它们 cherry-pick 到最后一个发布分支。最后,我们有带有标签的发布分支,可以帮助我们在版本之间移动。
我的理解正确吗?
pull
和cherry-pick
有什么区别?
GitLab Flow 建议也使用 master
和 feature
分支。功能完成后,我们将其合并回 master
分支。这部分看起来与 GitHub Flow 中的相同。
然后我的理解是,他们为我们提供了两种选择,具体取决于它是 SAAS 应用程序还是移动应用程序(可以向全世界发布)。
如果这是 SAAS 应用程序,我们使用环境分支,例如pre-production
和 production
。当我们准备好部署我们的应用程序时,这些分支是在 master
之外创建的。每个环境有不同的分支允许我们设置 CI/CD 工具来自动部署对这些分支的提交。如果存在严重问题,我们会在 feature
或 master
分支中修复它,然后将其合并到 environment
分支中。
至于可以向世界发布的应用程序(例如移动或桌面应用程序),我的理解是他们建议通过使用 release
分支而不是环境分支来使用不同的模型。我们仍然在 feature
个分支中完成所有工作,并在完成后将它们合并回 master
个分支。然后,当我们确保 master
分支足够稳定时,即我们已经执行了所有测试和错误修复,我们创建 release
分支并发布我们的软件。如果存在严重问题,我们首先在 master
分支中修复它,然后选择修复到 release
分支。
这个 post 提出已经一年了,但考虑到未来的读者和事实发生了一些变化,我认为它值得刷新。
GitHub Flow as originally depicted by Scott Chacon in 2011 assumed each change once reviewed on a feature branch
and merged into master
should be deployed to production immediately. While this worked at the time and conformed to the only GitHub Flow rule, which is anything in the master branch is deployable, it was quickly discovered that in order to keep master
a true record of known working production code the actual deployment to production should happen from the feature branch
before merging it into master
. Deploying from the feature branch
makes perfect sense as in the case of any issue production can be instantaneously reverted by deploying master
to it. Please take a look at a short visual introduction to GitHub Flow.
GitLab Flow 是 GitHub Flow 的一种扩展,伴随着一组 guidelines and best practices,旨在进一步标准化流程。除了促进准备部署 master
分支和功能分支(与 GitHub Flow 相同)之外,它还引入了其他三种分支:
Production
branch
- Environment branches:
uat
, pre-production
, production
- Release branches:
1-5-stable
, 1-6-stable
我认为以上名称和示例是自描述的,因此我不会进一步详细说明。
最近我在 GIT 中发现了工作流的三个概念:GitFlow、GitHub Flow 和 GitLab Flow。我已经阅读了 the nice articles,但我不太了解 GitLab Flow。可能是因为我不是母语人士:)
简要。
GitFlow
我们有一个主分支作为生产分支。我们还有一个开发分支,每个开发人员都在这里合并他的功能。有时我们会创建一个发布分支来在生产环境中部署我们的特性。如果我们在发布分支中有错误,请修复它并将更改拉入开发分支。如果我们在生产中有一个严重的错误,创建新的 hotfix-branch,修复错误并将分支与生产(master)和开发分支合并。
如果我们很少发布我们的工作结果,这种方法很有效。 (也许每 2 周一次)。
GitHub流量
我们有一个 master 分支作为生产分支。我们(作为开发人员)可以创建用于添加新功能或修复错误的分支,并将它们与生产(主)分支合并。听起来很简单。这种方式适合一天部署多次生产分支的极端编程。
GitLab 流程
我见过新术语,例如 pre-production、生产、发布(稳定)分支和暂存环境、pre-production 环境、生产环境。他们之间有什么关系?
我是这样理解的:如果我们需要添加新功能,我们会从 master 分支部署一个 pre-production 分支。完成功能后,我们从 pre-production 分支部署一个生产分支。 pre-production 分支是中间阶段。然后 master 分支从 production 分支中拉取所有更改。
如果我们想查看每个单独的功能,这种方法很好;我们只是在分行结帐我们需要看的东西。
但是如果我们需要展示我们的工作,我们会尽可能晚地创建一个带有标签的发布分支。如果稍后我们修复 master 分支中的错误,我们需要将它们 cherry-pick 到最后一个发布分支。最后,我们有带有标签的发布分支,可以帮助我们在版本之间移动。
我的理解正确吗?
pull
和cherry-pick
有什么区别?
GitLab Flow 建议也使用 master
和 feature
分支。功能完成后,我们将其合并回 master
分支。这部分看起来与 GitHub Flow 中的相同。
然后我的理解是,他们为我们提供了两种选择,具体取决于它是 SAAS 应用程序还是移动应用程序(可以向全世界发布)。
如果这是 SAAS 应用程序,我们使用环境分支,例如pre-production
和 production
。当我们准备好部署我们的应用程序时,这些分支是在 master
之外创建的。每个环境有不同的分支允许我们设置 CI/CD 工具来自动部署对这些分支的提交。如果存在严重问题,我们会在 feature
或 master
分支中修复它,然后将其合并到 environment
分支中。
至于可以向世界发布的应用程序(例如移动或桌面应用程序),我的理解是他们建议通过使用 release
分支而不是环境分支来使用不同的模型。我们仍然在 feature
个分支中完成所有工作,并在完成后将它们合并回 master
个分支。然后,当我们确保 master
分支足够稳定时,即我们已经执行了所有测试和错误修复,我们创建 release
分支并发布我们的软件。如果存在严重问题,我们首先在 master
分支中修复它,然后选择修复到 release
分支。
这个 post 提出已经一年了,但考虑到未来的读者和事实发生了一些变化,我认为它值得刷新。
GitHub Flow as originally depicted by Scott Chacon in 2011 assumed each change once reviewed on a feature branch
and merged into master
should be deployed to production immediately. While this worked at the time and conformed to the only GitHub Flow rule, which is anything in the master branch is deployable, it was quickly discovered that in order to keep master
a true record of known working production code the actual deployment to production should happen from the feature branch
before merging it into master
. Deploying from the feature branch
makes perfect sense as in the case of any issue production can be instantaneously reverted by deploying master
to it. Please take a look at a short visual introduction to GitHub Flow.
GitLab Flow 是 GitHub Flow 的一种扩展,伴随着一组 guidelines and best practices,旨在进一步标准化流程。除了促进准备部署 master
分支和功能分支(与 GitHub Flow 相同)之外,它还引入了其他三种分支:
Production
branch- Environment branches:
uat
,pre-production
,production
- Release branches:
1-5-stable
,1-6-stable
我认为以上名称和示例是自描述的,因此我不会进一步详细说明。