Commit Message Generation
Format
With ticket:
<type>: <ticket> - <description>
Without ticket:
<type>: <description>
Output: Plain text only - no code fences, no markdown formatting
Process
- Get branch name:
git branch --show-current - Extract ticket from branch (pattern:
[A-Z]+-\d+or[A-Z]{2,}-\d+) - Determine type using priority below
- Write imperative description (~50 chars, lowercase, no period)
- Output:
<type>: <ticket> - <description>or<type>: <description>
Type Selection
- feat - New functionality or UI changes
- fix - Bug fixes or regressions
- docs - Documentation only
- chore - Tooling, config, dependencies, maintenance
- refactor - Code restructuring without behavior change
- test - Test additions or modifications
- perf - Performance improvements
- style - Code style/formatting
- ci - CI/CD configuration
- build - Build system changes
Examples
Feature with ticket:
Branch: feat/PROJ-1234-user-auth
Changes: Added login component
Output: feat: PROJ-1234 - add user authentication
Bug fix without ticket:
Branch: fix/validation-error
Changes: Fixed form validation
Output: fix: resolve form validation error
Chore:
Branch: chore/deps-update
Changes: Updated dependencies
Output: chore: update npm dependencies
Common mistakes:
- ❌
fix: Fixed bug(past tense) → ✅fix: resolve bug - ❌
feat: Add feature(capitalized) → ✅feat: add feature - ❌
chore: update.(period) → ✅chore: update - ❌
feat: stuff(vague) → ✅feat: add user authentication