In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article focuses on "what are the methods for Git to submit specifications". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Next, let the editor take you to learn "what are the methods of submitting specifications for Git"?
Git is the most popular version control tool in the market. Well-written commit message can greatly improve the efficiency of code maintenance. However, in daily development, due to the lack of constraints on commit message, the filling content is random, the quality is uneven, and the readability is low and difficult to maintain. It is urgent to introduce commit message specification into the project.
I. mainstream norms of the market
The popular solution on the market now is the contractual submission Specification (Conventional Commits), which is inspired by and largely based on the Angular submission guidelines. The contractual submission specification is a lightweight convention based on the submission message. It provides a set of simple rules for creating a clear submission history; this makes it easier to write specification-based automation tools. This convention coincides with SemVer, which describes new features, bug fixes, and destructive changes in the submission message. Its message format is as follows:
Second, git commit normalization tool-- commitizen1. Global installation of commitizen & cz-conventional-changelog
Commitizen is a tool for writing qualified commit message in place of git commit instructions, while cz-conventional-changelog adapters provide conventional-changelog standards (contractual submission standards). Different adapters can also be used based on different requirements.
After installation, you can directly use git cz to replace git commit.
In global mode, the ~ / .czrc configuration file is required to specify Adapter for commitizen.
two。 Install commitlint & husky in the project
Commitlint is responsible for format validation of commit message, and husky is responsible for providing easier-to-use git hook.
Commitlint can only do format specification, can not touch the content. It is up to us to control the quality of the content.
3. Add the appropriate configuration
Create commitlint.config.js
Introduction of husky
4. Use
Execute git cz to enter interactive mode and fill in according to the prompts
The generated commit message format is as follows:
After completing the entry, husky will call commitlint to verify the format of message. By default, type and subject are required.
The option of any git commit instruction can be used on git cz instructions, such as git cz-a
Third, Commit message specification uses 1. Type in rrd-fe.
Type is required and is used to specify the type of commit. Two main type (feat and fix) and five special type (docs, style, build, refactor and revert) are specified. The rest of type is not used for the time being.
When a change includes the main type and the special type, the main type is adopted uniformly.
2. Scope
Scope is also required to describe the scope of the change, in the format of project name / module name, for example: node-pc/commonrrd-h6/activity, while we-sdk does not need to specify a module name. If commit modifies more than one module at a time, it is recommended to split it into multiple commit for easier tracking and maintenance.
3. Body
Body fill in the detailed description, mainly describe the situation before the change and the motivation of the change, do not require minor changes, but major requirements, updates, etc., must add body to explain.
4. Break changes
Break changes indicates whether destructive changes have been made, and changes involving break changes must indicate this item, such as version upgrade, interface parameter reduction, interface deletion, migration, etc.
5. Affect issues
Affect issues indicates whether a problem is affected. For example, when we use jira, we can enter the JIRA_ID of its influence in commit message. To enable this function, you need to get through jira and gitlab. Reference document: User Docs | GitLab
The filling method is for example:
4. Example 1, complete commit message example 2, corresponding git log
At this point, I believe that you have a deeper understanding of "what are the methods of submitting specifications in Git?" you might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.