编写格式化的 commit message
可以大大提升代码的维护效率。html
好比:git
commit
(好比文档改动),便于快速查找信息;commit
生成 Change log
;<type>(<scope>): <subject> // 空一行 <body> // 空一行 <footer>
其中,Header 是必需的,Body 和 Footer 能够省略。npm
type
用于说明 commit 的类别。gulp
feature
A new featurefix
A bug fixdocs
Documentation only changesstyle
Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)refactor
A code change that neither fixes a bug nor adds a featureperf
A code change that improves performancetest
Adding missing tests or correcting existing testsbuild
Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)ci
Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)chore
Other changes that don't modify src or test filesrevert
Reverts a previous commitscope
用于说明 commit 影响的范围,好比数据层、控制层、视图层、具体模块等等,视项目不一样而不一样。函数
subject
是 commit 目的的简短描述,不超过50个字符。工具
Body
部分是对本次 commit 的详细描述,能够分红多行。ui
BREAKING CHANGE
,用来描述当前 commit 与上一个版本不兼容的地方。spa
Issue
,用来描述当前 commit 针对的某个issue。插件
Commit message 和 Change log 编写指南code
太教条了,太累... 给你们分享一个我使用的工具。
JetBrains IDE
插件,在 GoLand
、PhpStorm
中 均可以在插件市场搜索 Git Commit Message Helper
。
插件地址:Git Commit Message Helper
安装后效果,在 git commit 时:
我们看一下效果:
这时,点击 Commit 或 Commit and Push... 便可。
赶快去体验吧。