Git Workflow
🚫
Non-Negotiable: Never commit broken code. Never push secrets.
Before ANY Coding
Create a feature branch:
git checkout -b feature/descriptive-nameExamples:
feature/user-authenticationfix/checkout-validationrefactor/database-queries
Commit Discipline
✅ Good Commits
# Short, imperative, no emojis
git commit -m "Add user authentication endpoint"
git commit -m "Fix validation bug in checkout form"
git commit -m "Refactor database queries for performance"❌ Bad Commits
git commit -m "🚀 Added some stuff and fixed things!!"
git commit -m "WIP"
git commit -m "asdfasdf"Before Committing Checklist
# 1. Build passes
npm run build
# 2. Tests pass
npm run test
# 3. Check what you're committing
git diff --stagedLook for in the diff:
- ⚠️ API keys / secrets
- ⚠️ console.logs / debug code
- ⚠️ Files in wrong directories
- ⚠️ TODO comments that shouldn't ship
The Golden Rule
# ALWAYS check what you're committing
git diff --staged
# Then verify:
# - No API keys / secrets
# - No console.logs / debug code
# - Files in correct locations
# - No TODO comments that shouldn't shipComprehensive .gitignore
Set this up on day 1:
# Environment
.env
.env.local
.env*.local
# Dependencies
node_modules/
vendor/
# Build
dist/
build/
.next/
# IDE
.idea/
.vscode/
*.swp
# OS
.DS_Store
Thumbs.db
# Logs
*.log
logs/
# Secrets (belt and suspenders)
*.pem
*.key
secrets/After Feature Complete
# Merge back to main
git checkout main
git merge feature/descriptive-name
# Clean up
git branch -d feature/descriptive-name