Git commit message格式规范(推荐)

2021-02-23  本文已影响0人  Android_开发工程师

Git commit message格式规范(推荐)

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

type(必须)

用于说明git commit的类别,只允许使用下面的标识

  1. feat:新功能(feature)。
  2. fix/to:修复bug
  3. docs:文档(documentation)。
  4. style:格式(不影响代码运行的变动)。
  5. refactor:重构(即不是新增功能,也不是修改bug的代码变动)。
  6. perf:优化相关,比如提升性能、体验。
  7. test:增加测试。
  8. chore:构建过程或辅助工具的变动。
  9. revert:回滚到上一个版本。
  10. merge:代码合并。
  11. sync:同步主线或分支的Bug

scope(可选)
scope用于说明 commit 影响的范围,比如数据层、控制层、视图层等等,视项目不同而不同。
例如在Angular,可以是location,browser,compile,compile,rootScope, ngHref,ngClick,ngView等。
如果你的修改影响了不止一个scope,你可以使用*代替。

subject(必须)
subject是commit目的的简短描述,不超过50个字符(超过可以再body 里进行说明)。

body(可选) :

改动的动机,详细描述等

footer (可选) :需求链接状态变化 (Closes #392)

这样规范git commit到底有哪些好处呢?

Examples :

feat($browser): onUrlChange event (popstate/hashchange/polling)

Added new event to $browser:

Closes #1213242

fix($compile): couple of unit tests for IE9

Older IEs serialize html uppercased, but IE9 does not...

Would be better to expect case insensitive, unfortunately jasmine does

not allow to user regexps for throw expectations.

Closes #17116

参考 :

angularJS :
https://github.com/angular/angular.js/blob/master/DEVELOPERS.md#-git-commit-guidelines

https://www.cnblogs.com/zhouqx979/p/13783425.html

上一篇 下一篇

猜你喜欢

热点阅读