Branch

仓库创建的分支主要有两类:

  1. 主要分支
    • master
    • develop
  2. 支持分支
    • Feature branches
    • Release branches
    • Hotfix branches

下面描述假定origin为远程仓库

master branch

master分支代码是处于可用于生产环境状态

We consider origin/master to be the main branch where the source code of HEAD always reflects a production-ready state.

develop branch

develop分支代码处于最新开发结果状态, 下次发布将从这里产生.

We consider origin/develop to be the main branch where the source code of HEAD always reflects a state with the latest delivered development changes for the next release. Some would call this the “integration branch”. This is where any automatic nightly builds are built from.

Feature branch

命名规范: 除了master, develop, release-*或hotfix-* 的任何其它名称

Feature分支用于开发新的功能, 它源自于develop分支, 最终将合并到develop分支.

Release branch

命名规范: release-*

Release分支用于准备一个新的产品发布. 它允许在发布前进行bug的修复, 功能的修改以及测试等.

Release分支源于develop分支, 最终将被合并到master和develop分支. 只有当develop分支处于即将发布的状态时, 才创建release分支以进行发布前的准备. 只有当release分支到达可以发布的状态时, 才被合并到master用于发布, 并且合并回develop分支. 版本号(package.json, git tag)只有在release分支才被创建并且增加.

Hotfix branch

命名规范: hotfix-*

当生产环境出现急需解决的问题时, Hotfix分支才被创建. 它源于master分支, 最后将被合并到master和develop分支.

git branch model

其它分支

  • 原型: 按照proto-*命名, 源于develop分支, 除非该原型将被采纳和使用, 否则不合并回develop分支.

Commit message

格式

  • 第一行少于50个字符, 格式 action(module[/submodule]): extra description
  • 空行
  • 详细介绍, 每行不超过72个字符
  • 空行
  • 引用区域, 包括bug, release, 或者tested-by, reported-by等

重点

  • 50 / 72
  • 空行
  • 现在式

模板

[feature|cleanup|improve|fix|docs|release|task](module/submodule): first line

message body

Resolves:
Documentation:
Releases:
Reported-by:
Tested-by:
Reviewed-by:
Suggested-by:

示例

commit e0c134b8bfa282379daec6a7137512d58f956443
Author: Brian Ford <btford@umich.edu>
Date:   Wed Sep 25 12:30:51 2013 -0700

    fix($compile): work around issue in jQuery 1.10.2
    
    jQuery 1.10.2 does not attach data to comment nodes, which previously broke `$compile`.
    This changes how elements with "transclude element" and a controller are compiled to
    avoid the issue.
    
    Resolves: #3764

参考