Git submission also has specifications. Let’s see how the goose factory does it

Time:2021-12-2

1、 Purpose

There is no place without rules. When reviewing git submission history, it is found that everyone’s git submission records have their own styles and habits, and there is no complete set of specifications, which is not conducive to reading and maintenance. Therefore, a set of GIT submission specification is needed to make the submission record clear and clear, so that people can know the purpose of this submission at a glance.

2、 Recognized and commonly used specifications in the industry

Angularjs is the most widely used specification at present. It is reasonable and systematic. It also has corresponding tool and plug-in support.Git submission also has specifications. Let's see how the goose factory does it

Specification structure:

It consists of three parts: header (key), body (can be omitted) and footer (can be omitted)

It is recommended that the characters of each of these three parts should not exceed 100 characters to avoid the impact of automatic line feed on aesthetics

//   Header
<type>(<scope>): <subject> 
//   One blank line
<body>
//   One blank line
<footer>

1. Header (key)

Record the main modification types and contents

It consists of three parts: type (required), scope (optional) and subject (required)

1.1、type

Required. The type of message. There are several common types

  • Feat: submit new function, memory: feature
  • Fix: fixed the bug
  • Docs: modify the contents related to the document. Memory: documentation
  • Style: format modification, without modifying code logic, such as formatting, line feed, etc
  • Refactor: refactor refactored code without adding new functions or fixing bugs, such as extracting a piece of code as a method and refactoring a function
  • Perf: performance, experience optimization, etc. memory: performance
  • Test: add a test case or modify an existing test case
  • Chore: changes in the construction process or auxiliary tools, non SRC and test modifications, such as construction process, dependency management, etc

When there are feat, fix and other types at the same time, the types are feat and fix.

1.2、scope

It is not required and is used to describe the scope affected by this submission, such as data layer, control layer, view layer, etc

1.3、subject

Required, short description of this submission

  • The verb begins with the first person present tense, such as add, instead of added and adds
  • First letter lowercase
  • No period (.)

2. Body (can be omitted)

The detailed description can be in multiple lines, and there is a blank line between and the header

3. Footer (can be omitted)

Footer is only used in the following two cases

  • Incompatible changes

Start with breaking change, followed by the description of the change, the reason for the change and the migration method

What is incompatible change? For example, the encryption method of user password has changed

  • Close issue

An issue has been modified by the current submission

The overall git message is as follows

Feature (data layer):   Short description

Detailed description

BREAKING   CHANGE:   Incompatible changes

Closes   Close issue

3、 Idea plug-in

What if you know the submitted specification, but often can’t remember the format?

At this time, the powerful idea plug-in git commit message helper is really fragrant

1. Installation

In settings – > plugins, search git commit message helper, click Install and restartGit submission also has specifications. Let's see how the goose factory does it

2. Use

On the GIT submission page, click Create commit message to open the following window. After editing, click OK

Git submission also has specifications. Let's see how the goose factory does it

Enter information in the following pop-up window

Git submission also has specifications. Let's see how the goose factory does it

The message submitted is as follows

Git submission also has specifications. Let's see how the goose factory does it


Pay attention to the official account: shrimp, share Java backend technology dry cargo, make progress every day.
Git submission also has specifications. Let's see how the goose factory does it