When writing commit messages, it’s ideal to make them easy for another developer to read and understand exactly what’s in the commit. Oftentimes, though, we write commit messages quickly just to push a branch at the end of a workday, for instance (I know I’m guilty of this).
One team member brought the Conventional Commits format to our attention. I’ve enjoyed using it and seeing the results when reviewing pull requests.
To enforce this pattern, I recommend using this tool: conventional-changelog/commitlint: 📓 Lint commit messages.
Verbatim from the readme:
In general the pattern mostly looks like this:
type(scope?): subject #scope is optional
Real world examples can look like this:
chore: run tests on travis ci fix(server): send cors headers feat(blog): add comment section
The conventional commit format is definitely worth trying for both team and personal projects.
Want to edit your commit messages before you do a pull request? Squash your commits!
Here’s my guide on how to do it.