Git Commit Message
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)
| Type | Meaning |
feat | A new feature |
fix | A bug fix |
docs | Documentation only changes |
style | Code style (formatting, no logic changes) |
refactor | Code refactor (no new features or fixes) |
test | Adding or fixing tests |
chore | Other 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.
🔹 5. Group Related Changes
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