Git Conventional Commits (Git代码提交说明规范)
2023-03-07 09:38:09 时间
Conventional Commits (代码提交说明规范)
Conventional Commits 是关于Git Commit 提交代码时, 填写的说明文字的一个规范. 这个规范提供了一套易于理解和使用的规则, 通过描述提交消息中的特性, 修复和重大更改, 创建易于阅读的提交历史, 也方便在其之上编写自动化工具.
提交时的消息格式应该按如下格式组织:
<type>[optional scope]: <description>
[optional body]
[optional footer(s)]
例子
feat: add hat wobble
^--^ ^------------^
| |
| +-> 简单的描述
|
+-------> 类型: chore, docs, feat, fix, refactor, style, or test.
前缀说明
各种前缀的使用场景:
- feat: 面向用户的功能的新特性, 不包括项目构建的新特性
- fix: bug修复
- docs: 任何文档相关的修改
- style: 格式方面的改动, 不涉及代码逻辑的改动
- refactor: 重构类型的修改, 例如修改一个变量名
- test: 测试代码相关的改动, 例如增加测试案例, 重构测试代码等
- chore: 日常工作, 例如更新组件版本号, 发布版本, 打标签等
例子
Commit message with description and breaking change footer
feat: allow provided config object to extend other configs
BREAKING CHANGE: `extends` key in config file is now used for extending other config files
Commit message with ! to draw attention to breaking change
feat!: send an email to the customer when a product is shipped
Commit message with scope and ! to draw attention to breaking change
feat(api)!: send an email to the customer when a product is shipped
Commit message with both ! and BREAKING CHANGE footer
chore!: drop support for Node 6
BREAKING CHANGE: use JavaScript features not available in Node 6.
Commit message with no body
docs: correct spelling of CHANGELOG
Commit message with scope
feat(lang): add Polish language
参考
相关文章
- 在 Go 里用 CGO?这 7 个问题你要关注!
- 9款优秀的去中心化通讯软件 Matrix 的客户端
- 求职数据分析,项目经验该怎么写
- 在OKR中,我看到了数据驱动业务的未来
- 火山引擎云原生大数据在金融行业的实践
- OpenHarmony富设备移植指南(二)—从postmarketOS获取移植资源
- 《数据成熟度指数》报告:64%的企业领袖认为大多数员工“不懂数据”
- OpenHarmony 小型系统兼容性测试指南
- 肯睿中国(Cloudera):2023年企业数字战略三大趋势预测
- 适用于 Linux 的十大命令行游戏
- GNOME 截图工具的新旧截图方式
- System76 即将推出的 COSMIC 桌面正在酝酿大变化
- 2GB 内存 8GB 存储即可流畅运行,Windows 11 极致精简版系统 Tiny11 发布
- 迎接 ecode:一个即将推出的具有全新图形用户界面框架的现代、轻量级代码编辑器
- loongarch架构介绍(三)—地址翻译
- Go 语言怎么解决编译器错误“err is shadowed during return”?
- 敏捷:可能被开发人员遗忘的部分
- Denodo预测2023年数据管理和分析的未来
- 利用数据推动可持续发展
- 在 Vue3 中实现 React 原生 Hooks(useState、useEffect),深入理解 React Hooks 的