Git 的提交样式规范
1.1 提交信息的结构
类型: 主题
主体内容(可选)
页脚(可选)
1.2 类型(type)
类型包含在标题中,并且可以是以下类型之一:
- feat: 一项新功能
- fix: 一个错误修复
- docs: 文档更改
- style: 格式化,缺少半冒号等;但没有代码更改
- refactor: 重构生产代码(即不是新增功能,也不是修改bug的代码变动)
- test: 添加测试;但生产代码不变
- chore: 构建过程或辅助工具的变动, 更新构建任务,程序包管理器配置等;但生产代码不变
1.3 主题(subject)
主题不得超过50个字符,应以大写字母开头且不以句号结尾。
其他注意事项:
- 以动词开头,使用第一人称现在时,比如change,而不是changed或changes
- 结尾不加句号(.)
1.4 主体内容(可选)
并非所有提交都足够复杂以保证有一个主体,因此它是可选的,仅在提交需要一些解释和上下文时才使用。用正文解释一次提交的内容和原因,而不是方式。
编写正文时,标题和正文之间必须有空白行,并且您应将每行的长度限制为不超过72个字符。
1.5 页脚(可选)
页脚是可选的,用于引用问题跟踪者ID。
1.6 提交消息示例
feat: Summarize changes in around 50 characters or less
More detailed explanatory text, if necessary. Wrap it to about 72
characters or so. In some contexts, the first line is treated as the
subject of the commit and the rest of the text as the body. The
blank line separating the summary from the body is critical (unless
you omit the body entirely); various tools like `log`, `shortlog`
and `rebase` can get confused if you run the two together.
Resolves: #123
See also: #456, #789
参考: