Free — no signup required

Enforcing the Standard with commitlint

1 min read

Automation Requires Discipline

Conventional Commits only deliver their value if every commit in the repository follows the format. A single WIP or fix stuff commit in a release window can cause the automated tool to miscalculate the version or generate a broken changelog. Enforcement must be automatic, not aspirational.

commitlint is a Node.js tool that validates commit messages against the Conventional Commits specification. It is typically wired into a Git commit-msg hook so that non-conforming messages are rejected before the commit is created locally.

Wiring it up is a one-time setup: install commitlint with the conventional-commits ruleset, install a Git hooks manager like husky to manage the commit-msg hook itself, and point that hook at commitlint. From then on, a commit message like "fixed the login bug" is rejected outright — commitlint reports exactly which required pieces are missing (an empty subject, no type prefix) — and the developer has to rewrite it in the proper type(scope): description form before the commit is even created locally.

CI-level enforcement: Local hooks can be bypassed with git commit --no-verify. For true enforcement, also run commitlint in your CI pipeline on pull requests, validating all commits in the PR branch. This catches bypassed hooks and enforces the standard for contributors who don't have the local tooling set up.

This is one of 18 chapters

Every chapter is free — Kubernetes, Terraform, SRE, distributed systems, and more — with fast daily review built in.

Sign up free