Git Discipline
Branch Naming
feat/user-authentication
fix/login-redirect-loop
chore/upgrade-dependencies
docs/api-reference-update
refactor/extract-auth-hook
test/add-payment-coverage
perf/optimize-image-loading
Rules: NEVER push directly to main or master. Branch from main, PR back to main.
Conventional Commits
Format: type(scope): description
# ✅ CORRECT
feat(auth): add Google OAuth login
fix(checkout): correct VAT calculation for EU users
chore(deps): upgrade Next.js to 15.3.1
docs(api): add rate limiting documentation
refactor(db): extract query builder into separate module
test(payment): add edge cases for declined cards
# ❌ WRONG
git commit -m "fix stuff"
git commit -m "WIP"
git commit -m "updates"
| Type | Use When |
|---|---|
feat |
New feature for the user |
fix |
Bug fix for the user |
chore |
Maintenance, no production impact |
docs |
Documentation only |
refactor |
Code change, neither fix nor feature |
test |
Adding or fixing tests |
perf |
Performance improvement |
Rules: imperative mood · under 72 chars · no period · lowercase after colon
Breaking changes:
feat(auth)!: remove password auth, OAuth only
BREAKING CHANGE: Password authentication removed. Migrate: docs/migration/oauth.md
PR Standards
Every PR must have: title (conv. commit format), description (what/why), test plan (checklist).
## Summary
- Add Google OAuth alongside email/password login
## Test Plan
- [ ] Sign in with Google (new user) — creates account
- [ ] Sign in with Google (existing email) — links account
- [ ] Email/password login still works
- [ ] Error state when OAuth fails
Pre-commit Checklist
git diff --staged— review every line- No debug code (
console.log,debugger, commented-out blocks) - No secrets (API keys, tokens)
- Tests pass
- Type check:
npx tsc --noEmit
Protected Branch Recovery
# Accidentally committed to main — move to a branch:
git stash
git checkout -b feat/your-feature
git stash pop
git push origin feat/your-feature