Skip to content

commitlint

Checks that git commit messages follow the conventional commit format.

Stars
18.8k
Forks
974
Licence
MIT
Language
TypeScript
Last update
4 days ago
Type
Dev tool

What it is

commitlint is a command-line tool that checks whether git commit messages follow a set pattern, such as starting with a type like feat, fix, or docs. It can run on each commit (commonly through husky) or during CI builds, and it is configured through files like .commitlintrc or a commitlint field in package.json. The output is used to keep history readable and to support tools that generate changelogs.

  • Reject a commit whose message does not start with an allowed type such as feat or fix
  • Share one rule set across projects by publishing or installing a shared config like @commitlint/config-conventional
  • Check commit messages during CI builds using the documented CI setup guide
  • Lint a string or a range of commits programmatically through the API packages

Great for

  • Teams that already use or want to adopt the conventional commit format
  • Projects that generate changelogs from commit history with conventional-changelog
  • Node.js projects that want commit checks run automatically on each commit or in CI
  • Developers who want shared commit rules across several repositories through shareable configs

Not ideal for

  • Projects with no commit message convention, since the tool only makes sense once a format is agreed on
  • Users who need a graphical interface, because the README describes only a CLI and a programmatic API
  • Environments without Node.js, since the README lists Node.js LTS >= 22.12.0 as a requirement
Step-by-step guide: how to use commitlintInstall, first run, examples, tips and FAQs

How to get it

  1. 1

    Install with a package manager

    You'll need: Node.js 22.12.0 or newer (LTS) · git 2.13.2 or newer

    Install the CLI as a dev dependency

    npm install --save-dev @commitlint/cli
  2. 2

    Run it

    • Install @commitlint/cli with npm as a dev dependency
    • Create a configuration file such as commitlint.config.js or add a commitlint field to package.json
    • Set up a git hook with husky to run commitlint on each commit (see the Local setup guide)
    • Make a commit with a non-conforming message to see the check reject it
  3. 3

    Get the most out of it

    • Start from a shared configuration such as @commitlint/config-conventional and adjust rules as needed
    • Use the rules reference in the docs to customize allowed types, scopes, and lengths
    • Add the CI setup guide to check commit messages during builds
    • Use the API packages (lint, load, read) to build custom checks

Downloads

Strengths

  • Widely used, with 18,786 stars and an active push history shown in the metadata
  • Rules are configurable and can be shared through npm packages
  • Works both locally on commit and in CI

Trade-offs

  • Requires Node.js and git with specific minimum versions, which adds setup for non-JavaScript projects
  • The README says it is not a sponsored project, so patch releases for older versions are not promised
  • Enforcing a convention takes team agreement; the tool cannot pick the format for you

How it compares

ProjectStarsTypeLevelUpdatedBest for
commitlint (this)18.8kDev toolintermediate4 days agoTeams that already use or want to adopt the conventional commit format
husky35.4kDev toolbeginner8 months agoJavaScript or Node.js projects that want shared pre-commit checks
git-history13.7kAppbeginner2.1 years agoDevelopers trying to understand why a file looks the way it does
delta32.6kDev toolbeginner9 days agoDevelopers who read a lot of git diffs or git show output in the terminal
oh-my-posh23.7kDev toolintermediate4 days agoDevelopers who want their terminal prompt to show extra context
gitui22.6kAppbeginner1 months agoDevelopers who already work in a terminal and want a visual view of git changes

Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.