role
Writing a formatted Commit Message can greatly improve the maintenance of your code.
Such as:
- Can provide more historical information, easy to browse quickly;
- You can filter certain
commit
(for example, document changes) to make it easy to find information quickly; - You can get it directly from
commit
generateChange log
;
What specification is used?
< type > (< scope >) : < subject > / / short line < body > / / short line < footer >Copy the code
The Header is required, and the Body and Footer can be omitted.
type
Type Indicates the type of commit.
feature
A new featurefix
A bug fixdocs
Documentation only changesstyle
Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)refactor
A code change that neither fixes a bug nor adds a featureperf
A code change that improves performancetest
Adding missing tests or correcting existing testsbuild
Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)ci
Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)chore
Other changes that don’t modify src or test filesrevert
Reverts a previous commit
scope
Scope is used to specify the scope of the commit impact, such as the data layer, the control layer, the view layer, specific modules, and so on, depending on the project.
subject
Subject is a short description of the commit purpose, no more than 50 characters long.
body
The Body section is a detailed description of the commit, broken into multiple lines.
footer
BREAKING CHANGE describes where the current COMMIT is incompatible with the previous version.
Issue, which describes an Issue to which the current commit is directed.
Refer to the article
Guide to writing Commit Message and Change log
What AIDS do you use?
Too dogmatic, too tired… I want to share with you a tool that I use.
Git Commit Message Helper is available in GoLand and PhpStorm.
Git Commit Message Helper
Git commit:
Let’s take a look at the results:
At this point, click Commit or Commit and Push… Can.
Go and experience it.
Recommended reading
- Use Docker to quickly build multi-version PHP development environment
- Is that how you use an indefinite parameter of a function?
- Handling mistakes gracefully is such an art.