Mid From PDF Version Control Git & GitHub

How do you enforce conventional commits or commitlint rules?

Conventional Commits define a standard format for commit messages, such as:

feat: add new user registration flow

fix: correct login validation

chore: update dependencies

To enforce this automatically, use commitlint with husky:

Setup:

npm install --save-dev @commitlint/{config-conventional,cli} husky

Create a commitlint.config.js:

module.exports = { extends: ['@commitlint/config-conventional'] };

Then add a Git hook:

npx husky install

npx husky add .husky/commit-msg 'npx --no-install commitlint --edit

"$1"'

Now every commit is checked — bad messages are rejected.

Example:

✅ feat: add password reset feature

❌ Added new password reset → ❌ rejected

Why this matters:

  • Enables automatic changelog and versioning.
  • Keeps Git history consistent.
  • Works well with tools like semantic-release.

More from Developer Essentials

All questions for this course
Toolliyo Assistant
Ask about tutorials, ebooks, training, pricing, mentor services, and support. I use public site content only—not admin or internal tools.

care@toolliyo.com

Need callback? Share your details