Introduction
Leaving a meaningful commit can be useful for when:
- working with group of people
- you want to refresh your memories in future
Recently, I started using conventional commit coupled with tools such as commitlint and commitizen. Conventional commit allows for auto generation of changelog through tools like release-please in github action
Conventional Commit
In commitizen, they offer following commit types to choose from:
Type | Description |
---|---|
feat | A new feature |
fix | A bug fix |
docs | Documentation only changes |
style | Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc) |
refactor | A code change that neither fixes a bug nor adds a feature |
perf | A code change that improves performance |
test | Adding missing tests or correcting existing tests |
build | Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm) |
ci | Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs) |
chore | Other changes that don't modify src or test files |
revert | Reverts a previous commit |
Here's the format:
<type>(<scope>): <subject>
Here's some example:
feat(navbar): changed color of navbar
docs: added contributor list to README
chore(deps) Update all non-major dependencies
Still, I wasn't entirely sure when to use which commit type and scope. For now, I'm looking at other open source projects and learning from their examples.