Conventional Commits

What are Conventional Commits?

The Conventional Commits specification is a lightweight convention on top of commit messages. It provides an easy set of rules for creating an explicit commit history, which makes it easier to write automated tools on top of.

cargo-commitlint enforces this specification to ensure consistent, meaningful commit messages across your project.

Format

<type>[optional scope]: <description>

[optional body]

[optional footer(s)]

Components

  • type: The type of change (feat, fix, docs, etc.)
  • scope: Optional scope indicating what part of the codebase is affected
  • description: A short description of the change
  • body: Optional longer description
  • footer: Optional footer for breaking changes or issue references

Commit Types

feat

A new feature. Introduces new functionality to the codebase.

feat: add user authentication

fix

A bug fix. Fixes a problem in existing functionality.

fix: resolve memory leak in parser

docs

Documentation only changes. No code changes.

docs: update API documentation

style

Changes that do not affect the meaning of the code (formatting, missing semicolons, etc.)

style: format code with rustfmt

refactor

A code change that neither fixes a bug nor adds a feature.

refactor: simplify error handling

perf

A code change that improves performance.

perf: optimize database queries

test

Adding missing tests or correcting existing tests.

test: add unit tests for parser

build

Changes that affect the build system or external dependencies.

build: update Cargo.toml dependencies

ci

Changes to CI configuration files and scripts.

ci: add GitHub Actions workflow

chore

Other changes that don't modify src or test files.

chore: update .gitignore

revert

Reverts a previous commit.

revert: revert "feat: add feature"

Breaking Changes

Breaking changes can be indicated in two ways:

  1. Add a ! after the type/scope: feat!: breaking change
  2. Add BREAKING CHANGE: in the footer
feat!: remove deprecated API

BREAKING CHANGE: The old API has been removed.
Use the new API instead.