Sub topic 3
Choosing a type: feat, fix, and the rest
The type is the first word of a conventional commit. It tells readers, and any tool that parses your history, what kind of change the commit makes. This chapter covers the two types the specification defines, the extra types most teams add, and how to decide between them when a change is ambiguous.
This chapter assumes you know the message structure from the previous chapter (type, optional scope, description, body, footers) and that you can read a MAJOR.MINOR.PATCH version number.
What the specification requires
Conventional Commits 1.0.0 defines exactly two types with meaning:
featis for a commit that adds a new feature to the codebase. It corresponds to aMINORversion bump in Semantic Versioning.fixis for a commit that patches a bug in the codebase. It corresponds to aPATCHversion bump.
The specification also says that types other than feat and fix may be used. It does not define them. The usual extra types come from the Angular commit guidelines, and @commitlint/config-conventional enforces that same list. That list is what most teams mean by "the conventional types."
Two details about the type token are easy to miss:
- Types are case-insensitive in the specification, but you should pick one casing and stay with it. Lowercase is the near-universal choice.
- The one exception is the footer token
BREAKING CHANGE, which must be uppercase. It is not a type.
The common type set
| Type | Use it for | Typical release effect |
|---|---|---|
| `feat` | A new capability visible to users or API consumers | MINOR |
| `fix` | A correction to behavior that was wrong | PATCH |
| `docs` | Documentation only, such as README or API docs | None |
| `style` | Formatting that does not change meaning: whitespace, semicolons, import order | None |
| `refactor` | Restructuring code without changing behavior | None |
| `perf` | A change whose purpose is to improve performance | Often PATCH, depends on the tool |
| `test` | Adding or correcting tests | None |
| `build` | Build system or external dependencies: bundler config, package manifests | None |
| `ci` | CI configuration and scripts | None |
| `chore` | Maintenance that fits nowhere else | None |
| `revert` | Undoing an earlier commit | Depends on what is reverted |
The "release effect" column describes common tooling defaults, not the specification. Only feat, fix, and breaking changes are tied to version bumps by the specification itself. A release tool may choose to treat perf as a patch release, for example, and most can be configured either way.
A decision procedure
Ask the questions below in order and stop at the first "yes". The order matters because it puts user-visible effects ahead of internal ones.
The diagram is a heuristic, not a law. Real diffs often touch several categories, and the next sections cover how to handle that.
feat versus fix
Most disagreements are between these two. The test is not how large the diff is. The test is whether the behavior was previously promised.
- If the software never claimed to do something and now does, it is a
feat. - If the software claimed to do something, did it wrongly, and now does it correctly, it is a
fix.
Here are three examples:
feat(export): add CSV output to the report command
fix(export): escape commas inside quoted CSV fields
fix(export): stop truncating reports larger than 1 MBThe second and third commits repair behavior the export feature already promised. A one-line change can be a feat, and a 500-line rewrite can be a fix.
Missing functionality that users reasonably expected is a gray area. If your documentation or issue tracker called it a defect, use fix. If it was a request for something new, use feat. The choice affects your version bump, so decide it by what users were told to expect.
The non-releasing types
The types below describe changes that, taken alone, should not alter what users experience. That is why they usually produce no release.
docs, style, and test
docs covers files such as README.md and guides, and also doc comments if your tooling publishes them. A docs commit must not change executable behavior.
style is the most misunderstood type. It means code style: whitespace, formatting, trailing commas, import ordering. It does not mean visual styling. A change to CSS that alters how a button looks is a feat or a fix, because users can see it.
test covers adding or fixing tests with no production change. If a bug fix comes with its regression test, put both in one fix commit. A separate test commit is for tests that stand alone.
build, ci, and chore
build covers things that affect how the artifact is produced: the bundler config, the package manifest, the lockfile, and dependency updates. ci covers pipeline definitions such as workflow files.
chore is the fallback. Use it sparingly. If most of your history is chore, the type has stopped carrying information. Before reaching for it, check whether the change fits build, ci, or refactor.
refactor and perf
A refactor changes structure without changing observable behavior. If the behavior changes, it is not a refactor, whatever you intended.
A perf commit is a refactor whose purpose is measurable speed or memory improvement. Use perf when you can say what got faster, and put the numbers in the body if you have them:
perf(search): cache compiled regexes between queries
Median query time on the 10k-document fixture dropped from 41 ms to 9 ms.Dependency updates
Dependency commits are a frequent source of inconsistency, so agree on a rule as a team. A reasonable rule has three cases:
- Routine version bumps with no user-visible effect use
build(deps). - A bump whose purpose is to fix a bug your users hit, such as a security patch, uses
fix(deps). - A bump that exposes a new capability to users uses
feat(deps), though this is rare.
Bots such as Dependabot and Renovate can be configured with a commit message prefix and scope. Set them up once so automated commits follow your rule instead of defaulting to prose.
Mixed changes: split them
When one working tree contains a bug fix, a refactor, and a new test helper, you have three changes. Staging them as separate commits keeps each type honest:
git add src/parser.py
git commit -m "fix(parser): reject unterminated string literals"
git add src/lexer.py
git commit -m "refactor(lexer): extract token table into a constant"Use git add -p to stage individual hunks within one file. If you cannot split a change, choose the type with the larger release effect. A commit that adds a feature and tidies nearby code is a feat, not a refactor.
Any type can carry a breaking change
The ! marker and the BREAKING CHANGE footer are independent of the type. A refactor that renames a public function is breaking, and so is a build change that drops support for an old runtime:
build!: drop support for Node 16
BREAKING CHANGE: the minimum supported Node version is now 18.Tools that follow the specification treat this commit as a MAJOR bump even though build normally releases nothing. When you choose a type, decide separately whether the change breaks consumers.
Customizing the list
The specification allows other types, so a team can define its own. Common additions are security, deps, or i18n. Before adding one, weigh three costs:
- Every new type is another decision for contributors.
- Release tools need to be told what the new type means, or they will ignore it.
- Shared tooling defaults, such as the commitlint preset, will reject types it does not know until you change its
type-enumrule.
A good bar is that a new type should change what the tooling does, or what a reader of the changelog sees. If it does neither, a scope does the same job without growing the vocabulary.
Common mistakes
- Using
fixfor every change that "improves" something. A fix needs a prior wrong behavior. - Using
featfor internal work such as a new private helper. If users and API consumers cannot observe it, it is arefactororchore. - Using
stylefor visual design changes. - Marking a behavior-changing commit as
refactorto avoid a version bump. This hides the change from the changelog and from the people who depend on it. - Using
chorefor everything, which empties the type of meaning.
Exercise
You change a function so it returns an empty list instead of raising an error when no results are found. The README documented the old error as intended behavior, and library users catch that error. Which type and marker do you use, and why?
Show answer
Use feat! or fix! with a BREAKING CHANGE footer, not refactor. The observable behavior changes, so refactor is wrong. Because the old error was documented as intended, this is a deliberate behavior change rather than a bug correction, which points to feat!. Users who catch the old error will break, so the change must be flagged as breaking and will produce a MAJOR bump. If the error had been undocumented and clearly a defect, fix! would fit better, and it would still be breaking.
Exercise
A single working tree contains a bug fix in auth.py, a reformat of utils.py with a code formatter, and an edit to .github/workflows/test.yml. How should you commit them, and with which types?
Show answer
Make three commits: fix(auth): ... for the bug fix, style(utils): ... for the formatter run, and ci: ... for the workflow file. Each commit then has one purpose, and only the fix triggers a PATCH release.