当前位置:网站首页>代码提交规范
代码提交规范
2022-06-28 07:10:00 【Windyº】
fix: 类型 为 fix 的提交表示在代码库中修复了一个 bug(这和语义化版本中的 PATCH 相对应)。feat: 类型 为 feat 的提交表示在代码库中新增了一个功能(这和语义化版本中的 MINOR 相对应)。- BREAKING CHANGE: 在可选的正文或脚注的起始位置带有 BREAKING CHANGE: 的提交,表示引入了破坏性变更(这和语义化版本中的 MAJOR 相对应)。破坏性变更可以是任意 类型 提交的一部分。对于 fix:、feat: 和 chore:,乃至更多其它的 类型 而言,它都是有效的。
- 其它在 fix: 和 feat: 之外的提交 类型 也都是支持的,例如 Angular 约定 中推荐使用 docs:、style:、refactor:、perf:、test:、chore:,但这些标签在约定式提交规范中并不是强制性的。
其他标签含义:
docs:文档(documentation)
style: 格式(不影响代码运行的变动)
refactor:重构(即不是新增功能,也不是修改bug的代码变动)
test:增加测试
chore:构建过程或辅助工具的变动
约定式提交规范
本文档中的关键词 “必须”、“禁止”、“需要”、“应当”、“不应当”、“应该”、“不应该”、“推荐”、“可以” 和 “可选” 应按照 RFC 2119 的描述解释。
- 每个提交都必须使用类型字段前缀,这由一个形如 feat 或 fix 的名词组成,其后接冒号和空格。
- 当一个提交为应用或类库实现了新特性时,必须使用 feat 类型。
- 当一个提交为应用修复了 bug 时,必须使用 fix 类型。
- 可选的作用域字段可以在类型后提供。作用域是描述代码库中某个部分的词组,封装在括号中,形如 fix(parser): 等。
- 描述字段必须紧接在类型或作用域前缀之后。描述指的是对代码变更的简短描述,形如 fix: array parsing issue when multiple spaces were contained in string.
- 在简短描述之后,可以编写更长的提交正文,为代码变更提供额外的上下文信息。正文必须起始于描述字段结束的一个空行后。
- 在正文结束的一个空行后,可以编写脚注(如果正文缺失,可以编写在描述之后)。脚注应当为代码变更包含额外的 issue 引用信息(例如它所修复的 issue,类似 Fixes #13 等)。
- 破坏性变更必须在提交的正文或脚注加以展示。一个破坏性变更必须包含大写的文本 BREAKING CHANGE,紧跟冒号和空格。
- 在 BREAKING CHANGE: 之后必须提供描述,以描述对 API 的变更。例如 BREAKING CHANGE: environment variables now take precedence over config files.
- 脚注必须只包含 BREAKING CHANGE、外部链接、issue 引用和其它元数据信息。
- 在提交说明中,可以使用 feat 和 fix 之外的类型。
为什么使用约定式提交
- 自动化生成 CHANGELOG。
- 基于提交的类型,自动决定语义化的版本变更。
- 向同事、公众与其他利益关系人传达变化的性质。
- 触发构建和部署流程。
- 让人们更容易地探索结构化的提交历史,降低贡献项目的难度。
边栏推荐
- R 语言 Kolmogorov-Smirnov 检验 2 个样本是否遵循相同的分布。
- Leetcode+ 51 - 55 retrospective and dynamic planning topics
- Overview, implementation and use of CRC32
- Recommend 10 popular jupyter notebook plug-ins to make you fly efficiently
- [rust daily] May 24, 2020 rush, rocket, Mun, caspin
- 看似简单的光耦电路,实际使用中应该注意些什么?
- MySQL installation steps - Linux configuration file JDK installation (II)
- Using interceptor and cache to complete interface anti brushing operation
- JS regular expression system explanation (comprehensive summary)
- 小小一款代码编辑器竟然也可以有程序运行之功能——Sublime Text3运行各种语言程序的总结
猜你喜欢

Devtools implementation principle and performance analysis practice

2021 VDC: technological architecture evolution of vivo Internet service for 100 million users | PPT download attached

Principle and practice of bytecode reference detection

声网 VQA:将实时互动中未知的视频画质用户主观体验变可知

Wechat applets - basics takes you to understand the life cycle of applets (I)

Jinshan cloud team shared | 5000 words to understand how Presto matches with alluxio

Introduction to Qualcomm platform WiFi -- Wi Fi display software

Techo day Tencent technology open day, June 28 online waiting for you!

Causes of wechat applet compilation page blank bug

最后的二十九天
随机推荐
Principle and practice of bytecode reference detection
金山云团队分享 | 5000字读懂Presto如何与Alluxio搭配
Floating and positioning
What should I do if the version is incompatible with the jar package conflict?
Comprehensive analysis of real enterprise software testing process
Techo Day 腾讯技术开放日,6月28日线上等你!
DOM parsing of XML file case code sentence by sentence analysis
Evolution of vivo push platform architecture
Face to face experience --- test engineer web side automation --- interview questions for large factories
pytorch RNN 学习笔记
Practice and exploration of vivo live broadcast application technology
R语言绘制 ggplot2 季节性图
面经---测试工程师web端自动化---大厂面试题
Server body 18: understanding and thinking of UDP reliable transmission (feeling from reading Yunfeng blog)
LeetCode+ 66 - 70 高精度、二分专题
My MVVM open source project "travel epidemic prevention app" has been released
FPM tool installation
Causes of wechat applet compilation page blank bug
服务器正文18:UDP可靠传输的理解和思考(读云凤博客有感)
[rust daily] May 24, 2020 rush, rocket, Mun, caspin