3.8 KiB
3.8 KiB
📝 Commit Message Convention
This project follows Conventional Commits specification for automated changelog generation and semantic versioning.
Format
<type>[optional scope]: <description>
[optional body]
[optional footer(s)]
Types
| Type | Description | Version Bump |
|---|---|---|
feat |
New feature | Minor |
fix |
Bug fix | Patch |
perf |
Performance improvement | Patch |
refactor |
Code refactoring | Patch |
docs |
Documentation changes | Patch |
style |
Code style changes | Patch |
test |
Adding or updating tests | Patch |
build |
Build system changes | Patch |
ci |
CI/CD changes | Patch |
chore |
Maintenance tasks | No bump |
Breaking Changes
Add BREAKING CHANGE: in the footer or ! after type to indicate breaking changes:
feat!: remove deprecated API endpoints
BREAKING CHANGE: The old API endpoints have been removed. Use the new v2 endpoints instead.
Examples
Features
feat: add GitHub auto-fill integration
feat(ui): implement dark mode toggle
feat!: migrate to Next.js 15 App Router
Bug Fixes
fix: resolve skill selection persistence issue
fix(mobile): correct responsive navigation layout
fix(a11y): improve keyboard navigation for forms
Performance
perf: optimize image loading with next/image
perf(build): reduce bundle size by 30%
Documentation
docs: update installation instructions
docs(api): add TypeScript examples
docs(readme): fix broken demo links
Refactoring
refactor: convert components to TypeScript
refactor(store): migrate to Zustand state management
Scopes (Optional)
Use scopes to indicate the area of change:
ui- User interface componentsapi- API related changesbuild- Build systemci- Continuous integrationdocs- Documentationtest- Testinga11y- Accessibilityperf- Performancemobile- Mobile-specific changes
Tools
Commitizen (Recommended)
Install commitizen for interactive commit messages:
npm install -g commitizen cz-conventional-changelog
echo '{ "path": "cz-conventional-changelog" }' > ~/.czrc
Use git cz instead of git commit:
git add .
git cz
VS Code Extension
Install "Conventional Commits" extension for VS Code to get commit message templates.
Automated Release Process
- Commit using conventional format
- Push to master branch
- Release Please analyzes commits
- Creates PR with changelog and version bump
- Merge PR to trigger release and deployment
Examples in Practice
# Adding new feature
git commit -m "feat(ui): add accessibility menu with font size controls"
# Fixing bug
git commit -m "fix(mobile): resolve navigation menu overflow on small screens"
# Breaking change
git commit -m "feat!: migrate to Next.js 15 App Router
BREAKING CHANGE: Pages directory structure has changed.
See migration guide for updating custom pages."
# Performance improvement
git commit -m "perf(build): implement code splitting for 50% bundle reduction"
# Documentation update
git commit -m "docs(contributing): add TypeScript coding standards"
Benefits
- ✅ Automated changelogs - No manual changelog maintenance
- ✅ Semantic versioning - Automatic version bumps based on commit types
- ✅ Release notes - Rich, categorized release notes
- ✅ Consistency - Standardized commit history
- ✅ Tooling integration - Works with Release Please, semantic-release, etc.