This is the second day of my participation in the August Text Challenge.More challenges in August

The magic git commit

Your Git commit message should be simple and clear, stating the purpose of the commit and what you are doing.

But in day-to-day development you either change too much and you’re too lazy to write about it, or you fix too many bugs and you’re too lazy to write about it. Sometimes Chinese and English are mixed, or fix bugs are flying around. Sometimes you ask “predecessors” what you’re fixing: forget it, look at the code changes yourself…

Don’t talk nonsense, on the specification

A commit message format

<type>(<scope>): <subject> < COMMIT type>(Impact range): Description Example Fix (DAO): Fixed invalid user table indexes.Copy the code

type

Type Specifies the git commit type. The following types should be used, or can be added or subtracted depending on the team

  • Feat: Added function
  • “Fix” : fixes bugs
  • “Docs” : Only modified documents, such as README, CHANGELOG, etc
  • Test: Adds or modifies test cases, including unit tests and integration tests
  • “Style” : Changed blank lines, indentation, reference package ordering, etc. (without changing code logic)
  • Perf: optimizes related content, such as improving performance, experience, and algorithm
  • “Refactor” : Code refactoring, “no new features or bug fixes”
  • Chore: Changing the build process, or adding dependency libraries, tools, etc
  • “Revert” : Rollback to a previous version
  • Merge: merges code

Scope (optional)

Scope is used to describe the scope of the impact of commit, which is described at different levels for different projects. If there is no special provision, it can also describe what functions are affected, etc.

subject

Subject is a short description of the purpose of a commit. It is no more than 50/80 characters long.

  • If you are not used to English, Chinese is recommended
  • If open source code, all recommended unified English, English can not be used to translate software
  • If the source code is open, you can attach the corresponding issue address
  • There is no punctuation at the end

Oh-my-zsh git commit example

Git commit (oH-my-zsh) git commit (oH-my-zsh

conclusion

Git commit specification is an essential task for the team. Every git commit specification is responsible for the team, as well as its own code constraints.

Just remember: (): This format will become familiar if you use it many times

I hope the above content is helpful to everyone. If it is feasible, I hope you can take the lead to use it in the team, which is not only helpful to yourself but also helpful to the team.

Give a thumbs up if you think the content is ok