Skip to main content

Command Palette

Search for a command to run...

Git Commit Message

Published
•2 min read•View as Markdown

1. Use the Proper Commit Message Structure

bashCopyEdit<type>: <short summary>

<body (optional)>
<footer (optional)>

✅ Example:

pgsqlCopyEditfeat: add login button to homepage

🔹 2. Stick to Common Commit Types (from Conventional Commits)

TypeMeaning
featA new feature
fixA bug fix
docsDocumentation only changes
styleCode style (formatting, no logic changes)
refactorCode refactor (no new features or fixes)
testAdding or fixing tests
choreOther changes like configs, build tools

🎯 These types help tools, teammates, and you understand what's in a commit at a glance.


🔹 3. Write Short, Clear Summaries (≤ 50 characters)

  • Start with a lowercase verb in present tense:
    ✅ add, fix, update, remove, refactor
    ❌ added, fixed, removing

✅ Good: fix: handle null values in API
❌ Bad: fixed bug when user submits form


🔹 4. Avoid Vague Messages

❌ update files
✅ chore: update ESLint config for new rules

🔍 Clear commits make debugging and reading history easier.


Instead of dumping everything in one commit, split by:

  • Purpose (fix vs style)

  • File/function

  • Task

✅ One commit per intent or logical change.


🧠 Bonus Tip: Use VS Code or Git Hooks to Help

  • Use extensions like "Conventional Commits" to auto-suggest types.

  • Add a commit template in your Git config.


✅ In Summary

1. Use structure: type: short description
2. Stick to: feat, fix, docs, style, refactor, chore, test
3. Use present tense verbs: add, fix, update
4. Keep it short and clear (≤ 50 characters)
5. One purpose per commit