git commit
git commit message规范
- feat: 新功能
- fix: 修改 bug
- docs: 文档
- perf: 性能相关
- refactor: 代码重构(就是不影响使用,内部结构的调整)
- test: 测试用例
- style: 样式修改
- workflow: 工作流
- build: 项目打包构建相关的配置修改
- ci: 持续集成相关
- revert: 恢复上一次提交(回滚)
- wip: work in progress 工作中 还没完成
- chore: 其他修改(不在上述类型中的修改)
- release: 发版
- deps: 依赖相关的修改
commitlint
安装
npm install --save-dev @commitlint/config-conventional @commitlint/cli
配置
新增 commitlint.config.js
js
//commitlint.config.js
module.exports = {
extends: ['@commitlint/config-conventional'],
}
若是使用 simple-git-hooks
,则在package.json添加配置
json
simple-git-hooks: {
'pre-commit': 'lint-staged',
'commit-msg': 'commitlint'
}