最近有幸參與到了一個開源專案的活動,看到別人提交的 commit 都很規范,自己的都是些什么鬼?經過一番搜索,發現網上很多都提到了 angularjs 的規范,
** 格式 **
Commit Message 格式
<type>(<scope>): <subject>
<空行>
<body>
<空行>
<footer>
分為 頁眉、正文和頁腳,其中頁眉包括了型別、范圍還有 subject,
type
| 型別 | 描述 |
|---|---|
| feat | 新增 feature |
| fix | 修復bug |
| docs | 僅僅修改了檔案,比如 README... |
| style | 修改了空格、格式縮進、逗號等,不改變代碼邏輯 |
| refactor | 代碼重構,沒有加新功能或者修復bug |
| perf | 優化相關,比如提升性能、體驗 |
| test | 測驗用例,比如單元測驗、集成測驗等 |
| chore | 改變構建流程、或者增加依賴庫、工具等 |
| revert | 回滾到上一個版本 |
scope
具體改動的檔案
subject
對正文的概括
body
just as in
includes motivation for the change and contrasts with previous behavior
footer
不兼容變動
如果當前代碼和上一個版本不兼容,需要在這里以 BREAKING CHANGE 開頭,后面接具體的描述
相關 issues
這里是和變動相關的 issues,例如:
Closed bugs should be listed on a separate line in the footer prefixed with "Closes" keyword like this:
Closes #234
or in case of multiple issues:
Closes #123, #245, #992
工具
既然有標準了,那肯定就會有對應的工具來輔助人們寫 commit message,工具貌似還不少,我這里使用 git-cz
在需要使用 git commit 的時候換成 git cz 就行了,
就像這樣 
是不是很方便?
公眾號:沒有夢想的阿巧 后臺回復 "群聊",一起學習,一起進步
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/155045.html
標籤:其他
下一篇:Go Micro 微服務搭建
