git commit 一些规范

原文链接

提交commit的一些格式:

1
2
3
4
5
<type>(<scope>): <subject>
<body>
<footer>

消息头


通常第一行不会超过70个字符,第二行一般都是空白行,后面的每行都不应该超过80个字符

Allowed values:

  • feat (新feature)
  • fix (修复bug)
  • docs (修改文档)
  • style (css修改)
  • refactor (代码重构)
  • test (测试相关)
  • chore (更新自动化任务,不修改业务代码)

Example values:

  • init
  • runner
  • watcher
  • config
  • web-server
  • proxy
  • etc.

The can be empty (eg. if the change is a global or difficult to assign to a single component), in which case the parentheses are omitted.

消息体


  • uses the imperative, present tense: “change” not “changed” nor “changes”
  • includes motivation for the change and contrasts with previous behavior

For more info about message body, see: