目录
- 作用
- 用的什么规范?
- type
- scope
- subject
- body
- footer
- 参考文章
- 用的什么辅助工具?
编写格式化的
commit message
能够大大提高代码的维护效率。
比如:
- 可以提供更多的历史信息,方便快速浏览;
- 可以过滤某些
(比如文档改动),便于快速查找信息;commit
- 可以直接从
生成commit
;Change log
<type>(<scope>): <subject>
// 空一行
<body>
// 空一行
<footer>
其中,Header 是必需的,Body 和 Footer 可以省略。
type
用于说明 commit 的类别。
-
A new featurefeature
-
A bug fixfix
-
Documentation only changesdocs
-
Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)style
-
A code change that neither fixes a bug nor adds a featurerefactor
-
A code change that improves performanceperf
-
Adding missing tests or correcting existing teststest
-
Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)build
-
Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)ci
-
Other changes that don't modify src or test fileschore
-
Reverts a previous commitrevert
scope
用于说明 commit 影响的范围,比如数据层、控制层、视图层、具体模块等等,视项目不同而不同。
subject
是 commit 目的的简短描述,不超过50个字符。
Body
部分是对本次 commit 的详细描述,可以分成多行。
BREAKING CHANGE
,用来描述当前 commit 与上一个版本不兼容的地方。
Issue
,用来描述当前 commit 针对的某个issue。
Commit message 和 Change log 编写指南
太教条了,太累... 给大家分享一个我使用的工具。
JetBrains IDE
插件,在
GoLand
、
PhpStorm
中 都可以在插件市场搜索
Git Commit Message Helper
。
插件地址:Git Commit Message Helper
安装后效果,在 git commit 时:

咱们看一下效果:
这时,点击 Commit 或 Commit and Push... 即可。
赶快去体验吧,有问题欢迎来的星球交流讨论 https://t.zsxq.com/iIUVVnA
作者:新亮笔记(关注公众号,可申请添加微信好友)
出处:https://www.cnblogs.com/xinliangcoder
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。