语义化git提交信息

如何语义化你的git提交信息?

例子

1
2
3
4
5
6
feat: add hat wobble
^--^ ^------------^
| |
| +-> Summary in present tense.
|
+-------> Type: chore, docs, feat, fix, refactor, style, or test.

Git Commit message 的格式

每次提交,Commit message 都包括三个部分:Header,Body 和 Footer

1
2
3
4
5
<type>(<scope>): <subject>
// 空一行
<body>
// 空一行
<footer>

Type

feat: 新功能(A new feature)
fix: 修复bug(A bug fix)
docs: 修改文档(Documentation only changes)
style: 格式(不影响代码运行的变动,空格、格式、缺少分号等)(Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
refactor: 重构(既不是新功能,也不是修复bug的代码变动)(A code change that neither fixes a bug nor adds a feature)
perf: 代码性能提升(A code change that improves performance)
test: 增加测试模块,不涉及生产环境的代码(Adding missing or correcting existing tests)
chore: 更新核心模块,包配置文件,不涉及生产环境的代码;(Changes to the build process or auxiliary tools and libraries such as documentation generation)

Git commit 模板

相关工具

参考链接

阮一峰-Commit message 和 Change log 编写指南
Github Angular Repositories commits message
Angular 团队的规范
Conventional Commits
git 工作流和git commit规范
Github semantic-release
Github Commitizen/cz-cli
如何写好 Git commit log?
优雅的提交你的 Git Commit Message
Git Commit Msg
Semantic Commit Messages