Git Commit Message Conventional Commit Conventions

5,311 0

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 Message conventions are established, it means that we will make each commit more carefully. We can no longer put all kinds of changes into a single git commit, making the history of code changes much clearer.
  • Only formatted Commit Messages can be used to automatically generate a Change log.

Git Commit Conventions

Plain Text
<type>(<scope>): <subject><body><footer>
NamePurpose
typeUsed to indicate the category of the Git Commit; only the identifiers in the table below are allowed
scopeUsed to indicate the scope affected by the Commit, such as the data layer, control layer, or view layer
subjectA brief description of the purpose of the Commit, generally no more than 50 characters
bodyOptional; may span multiple lines; a detailed description, separated from the header by a blank line
footerOptional; generally used for breaking changes or closing issues, separated from the body by a blank line
TypeDescription
syncSync the bug fixes from the mainline or a branch
mergeMerge code
revertRoll back to the previous version
choreChanges to the build process or auxiliary tools
testAdd software tests
perfPerformance-related improvements, such as enhancing performance or experience
refactorRefactoring; code changes that are neither new features nor bug fixes
styleFormatting changes that do not affect code execution
docsWriting or updating documentation
fix / toFix bugs, whether discovered by QA or by the developers themselves
featNew 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.

Leave a comment