創建git commit 模板
創建模板
在個人目錄下, 創建 .gitmessage
vi .gitmessage
復制代碼
并輸入以下信息
Who: Demand maker*When: versions affected*What:The content of the code changes* descrption:
* wiki/task:Why:The reason*How:Influence of change*
復制代碼
命令與模板生效
在個人目錄下,創建.gitconfig
vi .gitconfig
復制代碼
并輸入以下信息
[user]name = ***email = ***
[alias]st = statusci = commitbr = branchco = checkoutdf = diff[commit]template = ~/.gitmessage復制代碼
使用模板
git commit
復制代碼
模板解釋
-
Who: Demand maker
指需求的創建者、提出者或者是推動者;有助于今后排查是誰的需求。 那你可能要問為啥不寫是誰寫的代碼呢?額:因為已經有了 -
When: versions affected 這里指的本次改動影響的版本,或者是哪個版本生效,特別針對于提供給客戶端的接口,對于后期業務變動很重要
-
What:The content of the code changes 簡單明了指名改動的內容,如果比較復雜可以附上wiki或task
-
Why:The reason 改動的原因,即改動會帶來什么樣的實際效果
-
How:Influence of change 改動對代碼或業務造成的影響
參考
本文章參考了大神的文章:https://juejin.im/post/59110c322f301e0057e4c182,非常感謝