Git Crash Course: Branch Naming & Commit Messages

Frontend developer who weaves creativity and code, book lover, avid traveller and a tech enthusiast
Recently, someone pointed out that my commit messages weren’t industry standard. While I was following proper branching rules in my professional work, my commit messages themselves were quite random.
That feedback pushed me to explore what the industry actually considers best practice for branching and commit messages. As a result, this article came to life.
So, lets get started ➡️ .
↳ Branch naming - The Golden Rule
<type>/<short-description>
Common branch types
| Type | When to use |
feature/ | New feature |
bugfix/ | Fixing a bug |
hotfix/ | Urgent fix in production |
chore/ | Tooling, config, cleanup |
refactor/ | Code improvement without behavior change |
docs/ | Documentation only |
test/ | Adding or fixing tests |
✅ Good branch name examples
feature/cart-page
bugfix/login-validation
refactor/product-list
chore/eslint-config
docs/api-setup
❌ Here is what I used to do which is very bad
new-feature
cart
login
raj-branch
Bad names don’t explain what or why. Good names tell the story.
↳ Commit messages - Industry standard
The standard format
<type>: <short meaningful message>
Commit types you should use
| Type | Meaning |
feat | New feature |
fix | Bug fix |
refactor | Code change without feature/bug |
chore | Config, dependencies, cleanup |
docs | Docs only |
test | Tests |
style | Formatting (no logic change) |
✅ Good commit messages
feat: add add-to-cart functionality
fix: prevent duplicate items in cart
refactor: extract cart logic into hook
chore: configure eslint and prettier
docs: update project setup instructions
style: format product list component
❌ Bad commit messages
work in progress
fix bug
changes done
work done
Above commit messages are not clear and it does not tell what you did so avoid commit messages as above at any cost.
Here are some rules to remember while branching and committing:
Commit message length rule
a. First line: max 50 characters
b. Use present tense
c. No period at the end
✅
fix: handle empty cart state❌
fixed the empty cart stateOne Commit = One Logical Change
❌ Bad
feat: add login + fix navbar + update css✅ Good
feat: add login form fix: align navbar items style: update button spacing📌 This makes rollback, review and debugging easy.
Real project example
Branch
feature/product-listCommits inside that branch
feat: fetch product list from api
feat: render product cards
fix: handle loading state correctly
refactor: move api call to service layer
Jira / Task-based Branch Naming
feature/PROJ-123-cart-quantity
bugfix/PROJ-87-login-error
🙏 Quick Cheat sheet
Branch
feature/short-name
bugfix/short-name
refactor/short-name
Commit
feat: ...
fix: ...
refactor: ...
chore: ...
docs: ...
style: ...
Thanks for reading. Catch you next time.



