Semantic Commit Formatter
TL;DR: I made a new pre-commit hook for generating semantic commit templates from your git branch name. It's available here: semantic-commit-formatter
Recently, I've been bit by the semantic commit bug hard. No surprise there. You're telling me I slightly change how I format my commit messages, and now I can automate my entire versioning and release process? Sold.
But like many things in the field of programming, a cool idea can quickly become an attractive nuisance. One where you begin to focus on the work around the work, rather than what's important. To circumvent this, I wrote a pre-commit hook for myself to scaffold out these messages based on my git branch naming scheme. For example, running git commit
on a branch named story/add-organization-tables
would prefix my message with the following feat(add-organization-tables): <description>
. I think it's pretty neat.
Some quick highlights:
- Supports both
git commit
andgit commit -m
. - Configurable to enforce strict line length limits.
- Customizable for your workflow via a
~/.config/pre-commit-type-mappings.json
file.
More to come soon, but in the interest of shipping early - v1 is out now! A sample configuration is in the readme.