509 words
3 minutes
Commit 和 Change log 编写指南
Commit message
参考 Angular 规范[1]
<type>(<scope>) : <subject><空行><body><空行><footer>- type:本次提交的类别,必填
- scope:影响范围,可以不填
- subject:提交的标题,一句话概括提交的内容
- body:详细描述提交的内容,可以不填
- footer:放置写备注啥的,如果是 bug ,可以把 bug id 放入
Header
Header 部分只有一行,包括三个字段:type(必需)、scope(可选)和subject(必需)
feat(pencil): add 'graphiteWidth' optionType
type用于说明 commit 的类别,只允许使用下面标识。
- feat:新功能(feature)
- fix:修补 bug
- docs:文档(documentation)
- style: 格式(不影响代码运行的变动)
- refactor:重构(即不是新增功能,也不是修改 bug 的代码变动)
- test:增加测试
- chore:构建过程或辅助工具的变动
- merge:合并分支
- perf:优化相关,比如提升性能、体验
- revert:回滚到上一个版本
- build:构建
如果 type 为 feat 和 fix,则该 commit 将肯定出现在 Change log 之中。
scope
scope 用于说明 commit 影响的范围,比如数据层、控制层、视图层等等,视项目不同而不同。
subject
subject 是 commit 目的的简短描述,不超过 50 个字符。
Body
Body 部分是对本次 commit 的详细描述,可以分成多行。下面是一个范例。
More detailed explanatory text, if necessary. Wrap it toabout 72 characters or so.
Further paragraphs come after blank lines.
- Bullet points are okay, too- Use a hanging indentFooter
Footer 部分只用于两种情况。
1. 不兼容变动
2.关闭 Issue
如果当前 commit 针对某个 issue,那么可以在 Footer 部分关闭这个 issue 。
fix(graphite): stop graphite breaking when width < 0.1
Closes #234也可以一次关闭多个 issue 。
Closes #123, #245, #992Change log
Header
版本==》版本地址==》发布日期
## [9.0.0-rc.5](url)(2006-01-02)Describtion
详细描述分三种
- Bug Fixes bug 修复
- Features 新功能
- Performance Improvements 性能提升
<scope>: <subject> (issue) (commit)scpoe: 更新范围
subject: 详细信息
issue: 错误编号,如果没有可以不填
commit: 提交的 hash
core: allow css custom variables/properties in the style sanitizer (#33841) (61cc7a3), closes #23485 #23485参考文献
Commit 和 Change log 编写指南
https://gsxhnd.github.io/posts/git-commit-and-changlog/