Git Commit Message Specification.

This is an automatically translated post by LLM. The original post is in Chinese. If you find any translation errors, please leave a comment to help us improve the translation. Thanks!

Git commit message specification

Commit message format

1
<type>(<scope>): <subject>

type

Used to indicate the category of the git commit, only the following identifiers are allowed.

feat: New feature.

fix/to: Bug fix, can be a bug discovered by QA or a bug discovered by developers themselves.

  • fix: Generate diff and automatically fix the issue. Suitable for fixing the problem in one commit.
  • to: Only generate diff without automatically fixing the issue. Suitable for multiple commits. Use fix when finally fixing the issue.

docs: Documentation.

style: Formatting (changes that do not affect the code execution).

refactor: Refactoring (code changes that are neither new features nor bug fixes).

perf: Performance optimization, such as improving performance and user experience.

test: Adding tests.

chore: Changes to the build process or auxiliary tools.

revert: Revert to the previous version.

merge: Code merge.

sync: Synchronize bugs in the mainline or branch.

scope (optional)

Scope is used to indicate the scope affected by the commit, such as data layer, control layer, view layer, etc., which may vary depending on the project.

For example, in Angular, it can be location, browser, compile, compile, rootScope, ngHref, ngClick, ngView, etc. If your modification affects more than one scope, you can use * instead.

subject (required)

Subject is a brief description of the purpose of the commit, not exceeding 50 characters.

It is recommended to use Chinese (it feels that using Chinese to describe the problem can be clearer for Chinese people).

  • Do not add periods or other punctuation marks at the end.
  • According to the above specification, the git commit message will be in the following format:
1
2
fix(DAO): Missing username attribute in user query
feat(Controller): Development of user query interface

.