Glossary
Git's Imperative Mood
Git's imperative mood explained
Git's Imperative Mood
The imperative mood is a powerful commit message convention widely adopted across Git repositories. It aligns with Git's own message style. It's probably one of the most popular conventions along with the conventional-commits.
The Golden Rule
Your commit message should complete this sentence:
If applied, this commit will ...
For example:
- "If applied, this commit will add user authentication"
- "If applied, this commit will fix memory leak in worker pool"
Examples Reference Table
✅ Good (Imperative) | ❌ Bad (Non-Imperative) | ❌❌ Very Bad (Vague/Non-Professional) |
---|---|---|
Add login feature | ||
Fix memory leak | ||
Update documentation | ||
Remove deprecated API | ||
Refactor user service | ||
Optimize database queries | ||
Implement password reset | ||
Merge feature branch | ||
Test edge cases | ||
Configure CI pipeline |
Additional Good Examples
- Add input validation to login form
- Implement rate limiting for API endpoints
- Upgrade dependencies to latest versions
- Initialize Docker configuration
- Migrate database to PostgreSQL
- Resolve merge conflicts in user module
- Document API authentication process
Common Mistakes to Avoid
Fixed the thing that was brokenChanging some stuffUpdates and improvementsQuick fixWIPVarious changesMinor tweaks
Remember: The commit body can use any style you prefer, but the subject line must use the imperative mood to maintain consistency and clarity.