Git commit 规范

Commit message 格式

每次提交,Commit message 都包括三个部分:Header(必须),Body(可选) 和 Footer(可选)。

<type>(<scope>): <subject>
// 空一行
<body>
// 空一行
<footer>

1. header

header为一行内容,包括type(必须),scope(可选),subject(可选)

type

用于说明commit的类别,分为以下7个标识

  • feat:新功能(feature)
  • fix:修补bug
  • docs:文档(documentation)
  • style:格式(不影响代码运行变动)
  • refactor:重构(即不是新增功能,也不是修改bug的代码变动)
  • test:增加测试
  • chore:构建过程或者辅助工具的变动

建议:讲feat和fix放入change log中

scope

用于说明commit影响的范围:数据层、控制层、视图层等

subject

commit目的的简短描述

2. body

对本次commit的详细描述,可分行

注意:

  1. 使用第一人称现在时
  2. 说明代码变动动机,和以前行为对比
More detailed explanatory text, if necessary.  Wrap it to 
about 72 characters or so. 

Further paragraphs come after blank lines.

- Bullet points are okay, too
- Use a hanging indent

3.footer

使用场景:

  1. 不兼容变动
  2. 关闭issue

不兼容变动:当与上一版本不兼容,以BREAKING CHANGE 开头,加上对变动描述,理由和迁移方法

REAKING CHANGE: isolate scope bindings definition has changed.

    To migrate the code follow the example below:

    Before:

    scope: {
      myAttr: 'attribute',
    }

    After:

    scope: {
      myAttr: '@',
    }

    The removed `inject` wasn't generaly useful for directives so there should be no code using it.

关闭issue

Closes #123, #245, #992

revert

撤销以前的commit,必须以revert: 开头,加上被撤销commit的header


revert: feat(pencil): add 'graphiteWidth' option

This reverts commit 667ecc1654a317a13331b17617d973392f415f02.

body部分固定:This reverts commit &lt;hash>. hash 是被撤销commit的SHA标识符

 

 

参考文章

Commit message 和 Change log 编写指南

Git commit 标准化

Git commit 规范指南

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值