分支管理模式

发布于: 2020 年 05 月 27 日
分支管理模式

Base Patterns

Pattern:Source Branching

Create a copy and record all changes to that copy

Pattern:Mainline

A single, shared, branch that acts as the current state of the product

  • 长期稳定,可随时发布到生产的分支,一般是:master

Pattern:Healthy Branch

On each commit, perform automated checks, usually building and running tests, to ensure there are no defects on the branch

  • 随时保持自己的代码是健康的,经过测试的,是可以构建的。

Integration Patterns

Pattern:Mainline Integration

Developers integrate their work by pulling from mainline, merging, and - if healthy - pushing back into mainline

Pattern:Feature Branching

Put all work for a feature on its own branch, integrate into mainline when the feature is complete.

Pattern:Continuous Integration

Developers do mainline integration as soon as they have a healthy commit they can share, usually less than a day's work

Pattern:Reviewed Commits

Every commit to mainline is peer-reviewed before the commit is accepted.

Production Release Patterns

Pattern:Release Branch

A branch that only accepts commits accepted to stabilize a version of the product ready for release.

Pattern:Maturity Branch

A branch whose head marks the latest version of a level of maturity of the code base.

Variation:Long Lived Release Branch

变种:长期维护分支

Pattern:Environment Branch

Configure a product to run in a new environment by applying a source code commit.

Pattern:Hotfix Branch

A branch to capture work to fix an urgent production defect.

  • 解决线上问题从稳定分支拉出的临时分支。

Pattern:Release Train

Release on a set interval of time, like trains departing on a regular schedule. Developers choose which train to catch when they have completed their feature.

Variation: Loading future trains

Pattern:Release-Ready Mainline

Keep mainline sufficiently healthy that the head of mainline can always be put directly into production

Other Branching Patterns

Experimental Branch

Collects together experimental work on a code base, that's not expected to be merged directly into the product.

Future Branch

A single branch used for changes that are too invasive to be handled with other approaches.

  • 很少用

Collaboration Branch

A branch created for a developer to share work with other members of the team without formal integration.

Team Integration Branch

Allow a sub-team to integrate with each other, before integrating with mainline.

  • 大项目有很多个团队协作时使用。

来源:https://martinfowler.com/articles/branching-patterns.html

发布于: 2020 年 05 月 27 日 阅读数: 9
用户头像

wiflish

关注

wiflish 2007.10.29 加入

还未添加个人简介

评论

发布
暂无评论
分支管理模式