Nefi Logo
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 featureAdded login featureMade auth work
Fix memory leakFixed the bugOops, bug fixes
Update documentationUpdating the docsDocs stuff
Remove deprecated APIRemoved old methodsCleanup
Refactor user serviceRefactoring serviceBetter code
Optimize database queriesOptimized queriesDB perf improvements
Implement password resetImplemented password resetPassword thing
Merge feature branchMerged the branchFinally done!
Test edge casesTesting edge casesMore tests
Configure CI pipelineConfigured CICI stuff working now

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 broken
  • Changing some stuff
  • Updates and improvements
  • Quick fix
  • WIP
  • Various changes
  • Minor 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.

On this page