# Conventional Commits

> The Conventional Commits is a specification for writing structured commit messages.

## What are Conventional Commits and how do I write them?

The specification for commit messages in the form 'type(scope): description', for example 'feat: add search'. Common types are 'feat', 'fix', 'docs' and 'refactor'. Allows generating changelogs and versions automatically.

- Topic: Practices
- Type: practice

## Example

Wrong:

```text
Fixed stuff and updated login
```

Right:

```text
fix(auth): reject expired refresh tokens
```

The typed header says what kind of change it is and what changed, so tools can build changelogs and pick the version bump.

## Common mistakes

- Labeling every commit `feat`, which triggers wrong version bumps in release tools.
- Putting the breaking change note only in the description, where tools do not detect it.

## Key points

- The header follows `type(scope): description`, with a lowercase type such as `feat`, `fix` or `docs`.
- Breaking changes are marked with `!` after the type or a `BREAKING CHANGE:` footer.
- The type matches the change: new behavior is `feat`, bug fixes are `fix`, internal cleanups are not `feat`.

## Interview questions

### What commit types does Conventional Commits allow?

The spec defines `feat` and `fix`. Common conventions add `docs`, `refactor`, `test`, `chore`, `ci`, `build`, `perf` and `style`.

### How do Conventional Commits relate to SemVer?

Release tools map `fix` to a patch, `feat` to a minor and breaking changes to a major version bump.

### How do I enforce Conventional Commits?

Run a commit message linter in a git hook or in CI, so non-matching messages are rejected.

## Related cards

- [Commit Message](https://wonderium.dev/processes/commit-message.md)
- [SemVer](https://wonderium.dev/processes/semver.md)
- [Release](https://wonderium.dev/processes/release.md)
- [`git commit -m <message>`](https://wonderium.dev/processes/git-commit-m.md)
- [CI / CD](https://wonderium.dev/processes/ci-cd.md)

---

- Level: [Processes](https://wonderium.dev/processes.md)
- HTML version: https://wonderium.dev/processes/conventional-commits
- Last updated: 2026-11-25
