Git Commit Message Conventional Commit Conventions
Last month, a front-end expert joined the company and established some technical standards for our team. One of them concerned certain standards for writing Commit Messages when submitting code to Git. At first, I thought it was unnecessary, but after looking at the Commit records of many large projects, I realized that this standard is essentially an industry norm.
First, let's take a look at the Commit Messages in my CodeStudy project:

Now let's look at the Commit Messages from the Vue framework, the work of Evan You:

As expected, a well-structured Commit Message really catches the eye and allows people to quickly understand the content of the Commit and the functional modules involved. Next, let's talk about the benefits that standardized Commit Messages can bring.
Benefits of Standardization
- Makes it easier for programmers to trace the commit history and understand what happened.
- Once
Commit Messageconventions are established, it means that we will make each commit more carefully. We can no longer put all kinds of changes into a singlegit commit, making the history of code changes much clearer. - Only formatted
Commit Messages can be used to automatically generate aChange log.
Git Commit Conventions
<type>(<scope>): <subject><body><footer>| Name | Purpose |
|---|---|
| type | Used to indicate the category of the Git Commit; only the identifiers in the table below are allowed |
| scope | Used to indicate the scope affected by the Commit, such as the data layer, control layer, or view layer |
| subject | A brief description of the purpose of the Commit, generally no more than 50 characters |
| body | Optional; may span multiple lines; a detailed description, separated from the header by a blank line |
| footer | Optional; generally used for breaking changes or closing issues, separated from the body by a blank line |
| Type | Description |
|---|---|
| sync | Sync the bug fixes from the mainline or a branch |
| merge | Merge code |
| revert | Roll back to the previous version |
| chore | Changes to the build process or auxiliary tools |
| test | Add software tests |
| perf | Performance-related improvements, such as enhancing performance or experience |
| refactor | Refactoring; code changes that are neither new features nor bug fixes |
| style | Formatting changes that do not affect code execution |
| docs | Writing or updating documentation |
| fix / to | Fix bugs, whether discovered by QA or by the developers themselves |
| feat | New features (feature) |
Plugin Recommendation
The Commit Message Editor plugin is highly recommended for VS Code. It can quickly generate Git Commit Messages.

Comments
(0)No comments yet. Start the conversation.