Git Commit Message Generator
Generate concise, descriptive Git commit messages in English.
Process
Never use
git -C <path>. Always run git commands directly in the current working directory.
- •Run
git diff --cachedto check for staged changes - •If staged changes exist: generate commit message based on staged changes only
- •If no staged changes: run
git diffandgit statusto view unstaged and untracked files - •For untracked files, intelligently assess which need content review (code/config files) vs which can be inferred from filename (assets, dependencies)
- •Generate a single-line commit message (output ONLY the message, no follow-up questions)
Format
- •Imperative mood, under 72 characters
- •Types:
- •Add: New features or files
- •Update: Enhancements to existing features
- •Remove: Delete files or features
- •Rename: Rename files or variables
- •Fix: Bug fixes
- •Improve: General improvements
- •Optimize: Performance improvements
- •Refactor: Code restructuring without behavior change
- •Document: Documentation updates
- •Test: Add or update tests
- •Chore: Maintenance tasks (deps, config, CI)
Handling Complex Changes
When multiple types of changes exist in a single commit:
- •Choose the type that represents the primary intent of the change
- •Priority order (when uncertain): Add > Fix > Update > Refactor > Chore
- •If truly mixed and unrelated, suggest the user split into separate commits
- •Describe the most significant change; omit minor ancillary modifications
Examples
code
Add user authentication with JWT tokens Update navbar to include search functionality Remove deprecated API endpoints Rename userService to UserAccountService Fix null pointer exception in user service Improve error handling in payment module Optimize database queries for faster loading Refactor user service to use repository pattern Document API endpoints in README Test payment processing edge cases Chore: upgrade dependencies to latest versions Add login page with validation and error handling Fix authentication bug and update related tests