Programming Useful

Commit Messages Should Explain WHY, Not WHAT

Messages like "Fix bug" or "Update file" are useless 6 months later when you need to understand what changed and why. Write commit messages that explain the rea...

Problem

Messages like "Fix bug" or "Update file" are useless 6 months later when you need to understand what changed and why.

Solution

Write commit messages that explain the reason for the change. The diff shows WHAT changed — the message should explain WHY.

Benefit

Makes git blame and git log actually useful. Your team (and future you) will thank you during debugging.

Code Example

# Bad commit messages:
git commit -m "Fix bug"
git commit -m "Update styles"
git commit -m "Changes"

# Good commit messages:
git commit -m "Prevent duplicate orders when user double-clicks submit"
git commit -m "Increase timeout to 30s — API is slow under peak load"
git commit -m "Remove deprecated v1 endpoints before March deadline"

ES
Edrees Salih
6 hours ago

We are still cooking the magic in the way!