跳到主要内容

Git 提交日志规范

Git commit 日志基本规范 - 基于 Angular 社区,提交信息内容校验,启用正则表达式校验,表达式如下:

^(feat|fix|docs|style|refactor|test|build|chore|ci)(\(.+\))?: .{1,100}

提交消息示例

style($location): add couple of missing semi colons

Couple of typos fixed:
- indentation
- batchLogbatchLog -> batchLog
- start periodic checking
- missing brace

格式说明

<type>(<scope>): <subject>
<BLANK LINE>
<body>
<BLANK LINE>
<footer>

type 代表某次提交的类型,比如是修复一个 bug 还是增加一个新的 feature

英文
  • fix: A bug fix. Correlates with PATCH in SemVer
  • feat: A new feature. Correlates with MINOR in SemVer
  • docs: Documentation only changes
  • style: 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 feature
  • perf: A code change that improves performance
  • test: Adding missing or correcting existing tests
  • build: Changes that affect the build system or external dependencies (example scopes: pip, docker, npm)
  • ci: Changes to our CI configuration files and scripts (example scopes: GitLabCI)
  • revert: Reverts a previous commit
  • chore: Other changes that don't modify src or test files
  • chore: Changes to the build process or auxiliary tools and libraries such as documentation generation
中文
  • feat 新增功能
  • fix 修复问题
  • docs 仅仅修改了文档,比如README, CHANGELOG, CONTRIBUTE等等
  • style 仅仅修改了空格、格式缩进、都好等等,不改变代码逻辑
  • refactor 代码重构,没有加新功能或者修复bug
  • perf 优化相关,比如提升性能、体验
  • test 测试用例,包括单元测试、集成测试等
  • ci CI配置文件和脚本的更改(示例范围:GitLabCI)
  • chore 改变构建流程、或者增加依赖库、工具等
  • revert 回滚到上一个版本

辅助工具

终端插件

IDE之PhpStorm插件

参考文献