Skip to main content

Conventional Commits

Conventional Commits is a specification for formatting commit messages in software development projects. It provides a simple and standardized way to communicate the intent of a commit, making it easier for developers to understand changes made to a codebase.

Format

The format of a Conventional Commit message consists of three parts: type, scope (optional), and description. Each part is separated by a colon and a space. The type and description parts are required, while the scope part is optional.

Here is an example of a Conventional Commit message:

feat: add new feature to homepage

In this example, feat is the type, add new feature to homepage is the description, and there is no scope.

Types

The type part of a Conventional Commit message specifies the nature of the changes made in the commit. The following types are commonly used:

  • feat: A new feature or functionality has been added
  • fix: A bug or issue has been fixed
  • docs: Documentation has been updated or added
  • style: Changes have been made to the formatting or style of the code, without changing its functionality
  • refactor: Code has been refactored or restructured, without adding new functionality or fixing bugs
  • test: Changes have been made to the test suite
  • chore: Changes have been made to the build process, dependencies, or other non-code related tasks

Scope

The scope part of a Conventional Commit message specifies the area of the codebase that has been affected by the changes. It is optional and can be omitted if the changes affect the entire codebase.

Description

The description part of a Conventional Commit message provides a brief summary of the changes made in the commit. It should be clear and concise, and should not exceed 72 characters in length.