Introduction#
When using Git for code repository management, it’s inevitable that we need to submit commits. Each commit requires a message describing the changes made, helping collaborators quickly review and understand the development progress, thereby improving collaboration efficiency. Currently, the Angular convention is the most widely adopted Git commit message standard. This article references the following documents and provides a beginner-friendly. Angular GitHub Convention Reference Blog
Convention Details#
Commit Message Format#
<type>(<scope>): <subject>
<BLANK LINE>
<body>
<BLANK LINE>
<footer>
Among these, type and subject are mandatory, while scope is optional.
The first line is the Header (title), the second part is the Body (description), and the last part is the Footer (notes).
In practical development, it’s common to primarily follow the header convention, i.e., type(scope): subject. Examples are as follows:
feat(Extracurricular Activities): Display extracurricular activity credits
fix(Extracurricular Activities): Fix issue with displaying extracurricular activity credits
docs: Add environment setup tutorial for newcomers in README
test: Unit tests for Academic System API
Type#
Commonly used Type values include:
feat: A new featurefix: A bug fixdocs: Documentation changesstyle: Changes that do not affect code logic (e.g., formatting)refactor: Code refactoring that is neither a new feature nor a bug fixperf: Performance improvementstest: Adding or modifying testschore: Changes to the build process or auxiliary tools
Scope#
Specifies the module or file scope affected by the commit. For example:
- Extracurricular Activities
- Academic System
Subject#
- It is recommended to use Chinese.
- Briefly describe the change using a statement, e.g., “Fixed the issue with…”.
- Do not end the subject with a period or other punctuation.
Tools for Standardizing Git Commits#
VSCode users can install the git-commit-plugin extension. The usage effect is shown below:
