How to write good commit messages your future self will thank
Your Git history is the project's diary. How to write good commit messages with a simple convention that helps you find bugs, write changelogs, review faster.
"fix bug", "update", "wip": if your Git history looks like that, every bug hunt turns into an archaeological dig.
A three-part structure
feat: add an automatic table of contents to posts
The table of contents is built from level 2 and 3 headings so
readers can jump straight to the part they need in long posts.
Refs: #12- Subject line: the kind of change plus a short description, under 72 characters.
- Body: explain why, not what. The diff already shows what changed.
- Footer: link the issue, or note a breaking change.
One idea per commit
Small commits with exactly one idea each make git revert safe and git bisect precise. If your subject line needs the word "and", it should probably be two commits.
git add -p
git commit -m "fix: handle slugs with Vietnamese diacritics"