Git Commit Message Specification

Work together to create and grow together! This is the 31st day of my participation in the "Nuggets Daily New Plan · August Update Challenge", click to view the details of the event

Overview

I don't know how you write the commit message that provides the code in your respective projects. Some colleagues in our project wrote it very simply. They don't even know what to submit, whether it is a new feature or a bug fix. In essence, the commit message is to let the team members know the content of this submission. For this reason, we have formulated a specification, which stipulates that each colleague of the team submits the code according to this specification, so that the content of this modification can be understood through the message.

1. Format of Commit message

Each commit, Commit message includes three parts: Header, Body and Footer.

<type>(<scope>): <subject>
// 空一行
<body>
复制代码

Among them, Header, submission body for feat and fix types are required. Regardless of the section, no line should exceed 72 characters (or 100 characters). This is to prevent word wrap from affecting aesthetics.

1.1 Header

The Header section has only one line and includes three fields: type (required), scope (required), and subject (required).
(1) type
type is used to describe the category of commit, only the following 7 signs are allowed.

feat:新功能(feature)
fix:修补bug
docs:文档(documentation)
style: 格式(不影响代码运行的变动)
refactor:重构(即不是新增功能,也不是修改bug的代码变动)
test:增加测试
build:构建过程或辅助工具的变动
复制代码

(2) The scope
scope is used to describe the scope of the impact of the commit, such as indicator templates, rules online and offline, etc., which vary from project to project.
(3) subject
subject is a short description of the purpose of the commit, no more than 50 characters.

1. 以动词开头,使用第一人称现在时,比如change,而不是changed或changes
2. 第一个字母小写
3. 结尾不加句号(.)
复制代码

1.2 Body

The Body part is a detailed description of this commit, which can be divided into multiple lines.

1. 需要简要的列出各种正向或者反向的测试场景,测试通过,填pass。
2. 增加修改人信息
复制代码

2. Examples

2.1 feat example

feat(规则上下线、构建、生效、仿真生效): 添加规则上下线功能 

1. 规则上下线主流程,引擎正常订阅,fldl生成正常。 pass
2. 规则上下线,传入不存在的规则编号,异常提示。 pass

提交人:xxx
复制代码

2.2 Fix example

fix(模型模块): 模型测试失败

1. 导入mar模型,包含衍生字段。 pass
2. 导入mar模型,不包含衍生字段。 pass

提交人:xxx
复制代码

Plugin recommendation

IDEA can install plugins for code submission specifications.

  1. Install the plugin

image.png2. Select the plugin to submit when submitting

image.png

image.png

Guess you like

Origin juejin.im/post/7136698563840442375