Examples

Valid Commit Messages

Valid
feat: add user authentication
Valid
feat(api): add new endpoint
Valid
fix: resolve memory leak in parser
Valid
docs: update README with installation instructions
Breaking Change
feat!: breaking change in API
With Body
feat: add feature

This is a longer description of the change.

Closes #123

Invalid Commit Messages

Invalid
invalid: bad commit type

Error: type-enum — 'invalid' is not one of the allowed types

Invalid
Feat: capitalised type

Error: type-case — types must be lower-case

Invalid
feat: ends with a period.

Error: subject-full-stop — the subject must not end with a period

Conventional Commit Types

Common Types

  • feat - A new feature
  • fix - A bug fix
  • docs - Documentation changes
  • style - Code style changes
  • refactor - Code refactoring
  • test - Test additions/changes
  • chore - Maintenance tasks

Additional Types

  • perf - Performance improvements
  • build - Build system changes
  • ci - CI configuration changes
  • revert - Reverts a previous commit

CLI Usage Examples

Install Hook

cargo commitlint install

Validate Message

cargo commitlint check --message "feat: add feature"

Validate from Stdin

echo "feat: add feature" | cargo commitlint check

Custom Config

cargo commitlint check --message "feat: add feature" --config ./custom.toml