Commit Message Conventions
Overview
Clear commit messages help us understand the project's history and make it easier to track down bugs, understand features, and generate changelogs.
Format
We follow the Conventional Commits specification:
<type>(<scope>): <description>
[optional body]
[optional footer(s)]
Commit Types
Use these types for your commits:
| Type | Description | Example |
|---|---|---|
feat | New feature | feat(wishlist): add ability to share wishlists |
fix | Bug fix | fix(auth): resolve login redirect issue |
docs | Documentation only | docs(api): update authentication guide |
style | Code style changes (formatting, semicolons, etc.) | style(app): fix linting warnings |
refactor | Code change that neither fixes a bug nor adds a feature | refactor(store): simplify inventory query logic |
perf | Performance improvement | perf(search): optimize book search query |
test | Adding or updating tests | test(wishlist): add unit tests for sharing |
chore | Build process or auxiliary tool changes | chore(deps): update dependencies |
ci | CI configuration changes | ci(github): add automated deployment |
build | Changes to build system or dependencies | build(flutter): upgrade to Flutter 3.32 |
revert | Revert a previous commit | revert: feat(wishlist): add sharing |
Scopes
Scopes indicate what part of the codebase is affected:
App (Flutter)
auth- Authentication and user managementwishlist- Wishlist featuresinventory- Store inventory managementpos- Point of sale featuressocial- Social features (follows, reviews, etc.)cart- Shopping cartsearch- Search functionalityui- General UI components
Backend
api- API endpointsdb- Database schema or migrationsauth- Authentication servicesemail- Email servicespayment- Payment processingjobs- Background jobs
General
deps- Dependenciesconfig- Configuration filesdocs- Documentation
Writing Good Descriptions
Do's
✅ Use imperative mood ("add" not "added" or "adds")
feat(wishlist): add export functionality
✅ Be concise but descriptive
fix(auth): prevent duplicate user registration
✅ Reference issues when relevant
fix(search): resolve timeout on large catalogs (fixes #123)
Don'ts
❌ Don't use past tense
feat(wishlist): added export functionality // wrong
❌ Don't be vague
fix: various fixes // wrong
❌ Don't include unnecessary details in subject
feat(wishlist): add export functionality by creating new service layer with CSV generation // too long
Examples
Feature Addition
feat(wishlist): add ability to share wishlists
Users can now generate a shareable link for their wishlists.
The link allows read-only access to anyone with the URL.
Closes #456
Bug Fix
fix(auth): resolve login redirect loop
Fixed an issue where users would be stuck in a redirect loop
after logging in if they had special characters in their username.
The issue was caused by improper URL encoding in the redirect parameter.
Fixes #789
Refactoring
refactor(inventory): simplify stock check logic
Consolidated three separate stock checking methods into one
reusable utility function. No behavior changes.
Documentation
docs(api): update wishlist API examples
Added examples for the new wishlist sharing endpoints.
Updated error response documentation.
Breaking Changes
For breaking changes, add BREAKING CHANGE: in the footer:
feat(api): change wishlist response format
Updated the wishlist API to return items in a more structured format.
BREAKING CHANGE: The wishlist response now nests items under a `data` key.
Clients must update to access `response.data.items` instead of `response.items`.
Multi-line Commits
For complex changes, use the body to provide context:
feat(pos): implement offline mode support
Add ability for POS system to function without internet connection.
Transactions are queued locally and synced when connection is restored.
- Queue transactions in IndexedDB
- Sync on reconnection
- Show sync status indicator
- Handle conflict resolution
Closes #234, #567
Special Cases
Work in Progress
wip(feature): partial implementation of X
This is a work-in-progress commit. The feature is not complete.
Note: WIP commits should generally not be pushed to main branches.
Reverting Commits
revert: feat(wishlist): add sharing feature
This reverts commit abc123def456.
The feature caused performance issues in production and needs
to be redesigned. Will be reintroduced in a future PR.
Tools
Commitlint
The project uses commitlint to enforce these conventions:
# Install commitlint
npm install --save-dev @commitlint/cli @commitlint/config-conventional
# Commits that don't follow conventions will be rejected
git commit -m "bad commit message" # ❌ Fails
git commit -m "feat(wishlist): add export" # ✅ Passes
Git Hooks
We use Husky to run commitlint automatically:
# The commit hook runs automatically
git commit -m "your message"
Benefits
Following these conventions enables:
- Automatic changelog generation
- Better git history readability
- Semantic versioning automation
- Easier debugging - Find when features were added or bugs were fixed
- Clear communication - Team members understand changes at a glance