Back

/ 2 min read

The Modern Way to Git Commit

Remember the last time you scrolled through a git history filled with “updates” and “fixes”? Let’s turn that mess into something useful.

The Pattern That Makes Sense

Every commit message follows this structure:

Terminal window
type(scope): short description
[optional longer description of what changed and why]

Think of it like sorting your laundry - each piece has its place.

The Essential Types You Need

✨ Features (feat)

When you’re adding something new:

Terminal window
feat(user): add password reset functionality
feat(dashboard): create new analytics widget

🐛 Bug Fixes (fix)

When something’s broken:

Terminal window
fix(checkout): prevent double payment submission
fix(search): handle empty query results

🔧 Technical Stuff (chore/refactor)

Behind-the-scenes work:

Terminal window
chore(deps): upgrade to React 18
refactor(api): simplify error handling

Real Benefits, Not Just Theory

  1. Automated Everything: Generate changelogs automatically
  2. Better Collaboration: Team members know what changed without diving into code
  3. Cleaner History: Find important changes quickly
  4. Semantic Versioning: Tools can figure out version bumps based on commit types

Quick Rules to Live By

  • Keep the first line under 50 characters
  • Use present tense (“add” not “added”)
  • Think about what the change does, not what you did
  • Include the scope if it helps (but skip it if it doesn’t)

Pro Tips

  • Use feat: for anything users can see
  • Use fix: for bug fixes only
  • Use chore: for maintenance tasks
  • Add ! after type for breaking changes: feat!:

Remember: Good commit messages are like good documentation - they help your future self and others understand what happened and why.