Git Commit 規範

AngularJS團隊的AngularJS Git Commit Message Conventions是目前使用最廣的規範,清晰的提交信息會使咱們很容易追蹤定位項目歷史。git

使用最多的格式規範以下:github

type(scope?): subject
body?
footer?
複製代碼

git commit 引導

Commitizen將提示和引導咱們在提交時填寫所需的提交字段。npm

在提交時執行git cz代替git commitjson

Image


git commit 校驗

Commitlint可以幫助團隊遵照git commit規範,當提交信息不符合格式規範時,提交鉤子運行後拒絕提交。bash

使用時只需安裝依賴:npm install --save-dev commitizen @commitlint/cli @commitlint/config-conventionalide

.commitlintrc.yml中配置規則Rules。 並在package.json中添加:ui

"scripts": {
  "commitmsg": "commitlint -E GIT_PARAMS"
}
"husky": {
  "hooks": {
    "commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
  }
}
複製代碼

效果以下: spa

Image

Enjoy 😉.code

相關文章
相關標籤/搜索