編寫格式化的 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... 便可。
趕快去體驗吧。