Writing Commit Messages

Okay, real talk: writing commit messages is one of those things most people ignore until it bites them. I used to smash git commit -m "changes" like it owed me money. Six weeks later? No clue what I changed. None. Zilch.

Commit messages aren’t just busywork—they're the narration of your project’s history. Do it right, and future you (or your team) will be so grateful.

Why Commit Messages Actually Matter

Every commit is a chance to explain why a change happened. Not just what changed. You can see what in the code diff—but the why? That’s in your message.

Good commit messages help you:

  • Understand what happened and when
  • Spot the change that introduced a bug (hello, git blame)
  • Collaborate without endless Slack questions
  • Stay sane when revisiting code you haven’t touched in months

When working on a team—or on open source—bad commit messages can be the equivalent of handing over your code with a shrug and walking away. Don’t be that dev.

Best Practices That Don’t Suck

You’ve probably heard these before, but here’s the version your developer brain will actually remember:

  1. 1
    Start with a short summary (under 50 characters). Think tweet-sized headline.
  2. 2
    Use present tense. Not “Added button,” but “Add button.”
  3. 3
    Be specific. “Fix crash on login when username is blank” > “fixed bug.”
  4. 4
    Explain the why if it’s not obvious. Add a second paragraph if needed.
  5. 5
    Use line breaks. Git won’t yell at you. Promise.

And if you want to go full power-user? Try Conventional Commits:

bash
1
2
3
          feat: add responsive navbar  
fix: prevent crash when user token is missing  
docs: update install instructions in README  
        

This format works great with tooling like semantic release or changelog generators. It’s like giving your repo superpowers.

Real Examples You Can Steal

Here’s what good commit messages actually look like in real life:

bash
1
2
3
4
5
          Initialize project with Vite and Tailwind  
Add dark mode toggle to header component  
Fix 404 error when navigating to profile page  
Refactor user form into separate module  
Update README with deployment steps  
        

And here’s what not to do unless you want future-you to cry:

bash
1
2
3
4
5
          stuff  
changes  
update  
fix it  
final version fr fr  
        

Seriously, don't be that person. "final final" is never final.

Final Thoughts and What’s Next

Great commit messages aren’t about being fancy—they’re about being kind to yourself (and your teammates). Writing clear, thoughtful messages takes a few extra seconds, but it pays off every single time you dig through your Git history.

Next up: we’re talking about how to undo mistakes in Git. Because yes, we all mess up sometimes—and thankfully, Git makes it surprisingly easy to go back. Check out the next lesson: Fixing Mistakes in Git

Trust me, this is one Git skill you’ll thank yourself for later.