
As a developer, you're probably no stranger to the world of version control systems like Git. But even if you're well-versed in the basics of Git, using conventional commits can be a game-changer when it comes to communicating your peers and yourself.
In this post, we'll take a deep dive into what conventional commits are, why they're important, and how to use them effectively. So, let's get started!
A conventional commit is a type of commit message that follows a specific format, making it easy for others (and yourself) to understand the purpose and scope of each change.
Using conventional commits has several benefits:
When writing your commit message, choose one of the following types:
fix: For fixing bugs or resolving issuesfix(item): calling out which item was fixedfeat: For adding new features or functionality
feat(item): For calling out which featuredocs: For updating documentation or improving readabilitychore:: For updating documentation or improving readabilityI tend to use conventional commits styles for my commits. But not enforced, just manual best effort. However, some repos have strict enforcement to generate the changelog from the commits. I'll dig into that below.
When writing your commit message, follow these best practices:
Example commit message: fix: Update README.md to include new feature

At first, it may seem like a lot of work to write a commit message. But you'll find that writing good commit messages becomes easier as you get used doing it. Also, I also recommend committing more often.
I often teach people to think about making commits like save checkpoints in a video game. When you beat a boss, or complete a level, it creates a save point. Do the same with your commits. It makes it much easier to review and track down issues compared to a three-day coding bender where half the repo is changed in a single commit.
Many open source projects use conventional commits, vite for example and some even enforce it via tools like commitlint.
This is be great for a couple of reasons. The standard makes it easier to generate release notes and changelog from the commit messages.
In those cases I use the commitizen tool to enforce the conventional commits.
## Install
pnpm install -g commitizen
pnpm install -g cz-conventional-changelog
echo '{ "path": "cz-conventional-changelog" }' > ~/.czrc
## Usage
git cz

But be sure to review the rules for the repository your contributing too.
Using conventional commits doesn't take much time. I've found it makes it easier to come up with commit messages. And it improves your code's readability and enhances collaboration. It's an easy habit to get into, and you'll find it a requirement for many open source projects.
Might as well start doing it everywhere.