Published on

Commit convention

Authors
  • avatar
    Name
    Khánh
    Twitter

Types of Commit Conventions

There are two main types of commit conventions:

1. Custom Conventions

Custom conventions can be defined by the team or project using any rules they see fit. Some common rules include:

Dòng thứ 1: Tóm tắt nội dung thay đổi trong commit
Dòng thứ 2: Dòng trống
Dòng thứ 3 trở đi: Lý do đã thay đổi

2. Conventional Commits

Conventional commits are a set of widely used guidelines for writing commit messages that are human- and machine-readable. They are based on the following format:

[type]([optional scope]): [description]

[optional body]

[optional footer(s)]

Where:

[type] and [description] are required in every commit. [type] is used to classify the commit:

  • feat: Use for new features
  • fix: Use for bug fixes
  • docs: Use for changes to documentation
  • style: Use for changes that do not affect the code logic
  • refactor: Use for changes that improve the code structure, which may involve logic changes such as removing redundant code, renaming variables, simplifying - code, etc.
  • perf: Use for changes that improve the performance of the system
  • test: Use for changes related to testing in the system (writing test cases, unit tests, etc.)
  • build: Use for changes related to building the system
  • ci: Use for changes related to CI/CD of the system
  • chore: Use for changes that are not related to code (chores) [optional scope] is used to describe the scope of the source code change [description] is the commit message

Example:

feat(oms-web): clone item detail page from wms
feat(wms-web): create warehouse

Conclusion

The choice of whether to use custom conventions or conventional commits depends on the team and the rules of the project. However, commits should always be clear and concise, and using conventional commits can make it easier to read and find commits in the future.

References