← All posts

How to Write a Good Commit Message (and Why It Matters)

Writing clear commit messages helps you and your teammates understand what changed and why.

🚀 The Simple Version

Why Commit Messages Matter

Think of a commit like a note you leave for yourself after you finish a homework assignment. Later, you can read it and remember why you did what you did, which saves time and frustration.

What a Good Commit Message Looks Like

A good message is short but descriptive, like a headline that tells the story in one line. Below is a typical format:

feat: add user login page

Add a new login page with form validation and remember‑me option.
This improves user experience and reduces support tickets.

Closes #42

How to Write One: The Three Parts

  • Header – 50 characters or less, no period, a brief summary.
  • Body – optional, explain the why, not just the what.
  • Footer – optional, link to issues or tickets.

Quick Tips & Common Mistakes

  • Use the present tense: "Add", not "Added".
  • Avoid vague words like "fixed" or "changed".
  • Don’t write a long paragraph; keep it readable.
  • Check for typos – a clear message is professional.

Why It Helps Later

When you or someone else looks back at the project, a clear message lets you see the purpose of each change, debug faster, and merge code without surprises.