当前位置:网站首页>代码提交规范
代码提交规范
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。
- 基于提交的类型,自动决定语义化的版本变更。
- 向同事、公众与其他利益关系人传达变化的性质。
- 触发构建和部署流程。
- 让人们更容易地探索结构化的提交历史,降低贡献项目的难度。
边栏推荐
- What is a consistent hash? What scenarios can it be applied to?
- 声网 VQA:将实时互动中未知的视频画质用户主观体验变可知
- Devtools implementation principle and performance analysis practice
- DOM parsing of XML file case code sentence by sentence analysis
- LeetCode+ 66 - 70 高精度、二分专题
- 文件头信息对照表
- Will Internet talents be scarce in the future? Which technology directions are popular?
- Server body 18: understanding and thinking of UDP reliable transmission (feeling from reading Yunfeng blog)
- Puge -- understanding of getordefault() method
- 【Rust翻譯】從頭實現Rust异步執行器
猜你喜欢
Evolution of vivo push platform architecture
VM332 WAService.js:2 Error: _vm.changeTabs is not a function报错
看似简单的光耦电路,实际使用中应该注意些什么?
Pfizer's new Guankou medicine has entered the Chinese market, and the listing of relevant products of domestic pharmaceutical enterprises is just around the corner
Speech enhancement - spectrum mapping
[C#][转载]furion框架地址和教程地址
ABAP 技能树
VM332 WAService. js:2 Error: _ vm. Changetabs is not a function
面经---测试工程师web端自动化---大厂面试题
C language tutorial
随机推荐
Floating and positioning
Leetcode+ 51 - 55 retrospective and dynamic planning topics
XML序列化向后兼容
2021 VDC: technological architecture evolution of vivo Internet service for 100 million users | PPT download attached
金山云团队分享 | 5000字读懂Presto如何与Alluxio搭配
R 语言 ggmap
Trie string statistics
redis的入门学习到起飞,就这一篇搞定
[digital statistics DP] counting problem
Yesterday, I went to a large factory for an interview and asked me to do four arithmetic operations. Fortunately, I am smart enough
MySQL installation steps - Linux configuration file JDK installation (II)
Huawei cloud computing physical node cna installation tutorial
最后的二十九天
"Jay bear" plummeted by 96.6%. Why is NFT with star goods cold?
代码没写错,渲染页面不显示原因
C语言教程大全
Server body 18: understanding and thinking of UDP reliable transmission (feeling from reading Yunfeng blog)
[online tutorial] official iptables tutorial -- learning notes 1
[produced by Xinghai] operation and maintenance inspection collection
编译原理期末复习