Conventional commits, PR practices, branching strategies
Modern Git workflows and best practices.
<type>(<scope>): <subject>
<body>
<footer>
feat: New feature
fix: Bug fix
docs: Documentation only
style: Formatting, missing semi-colons, etc
refactor: Code change that neither fixes a bug nor adds a feature
perf: Performance improvement
test: Adding missing tests
chore: Updating build tasks, package manager configs, etc
ci: Changes to CI configuration
build: Changes to build system or dependencies
revert: Reverting a previous commit
# Simple
git commit -m "feat: add user authentication"
# With scope
git commit -m "fix(api): handle null user IDs"
# With body
git commit -m "feat: add dark mode
Implements dark mode theme toggle with:
- System preference detection
- Manual override option
- Persisted user choice"
# Breaking change
git commit -m "feat!: redesign API endpoints
BREAKING CHANGE: /api/v1/users is now /api/v2/users"
feature/add-user-auth
fix/login-redirect-bug
refactor/simplify-api
docs/update-readme
chore/update-dependencies
feat: Add user authentication
fix: Resolve login redirect issue
docs: Update API documentation
## Summary
Brief description of changes
## Changes
- Change 1
- Change 2
- Change 3
## Testing
- [ ] Unit tests pass
- [ ] Integration tests pass
- [ ] Manual testing completed
## Screenshots
[If UI changes]
## Breaking Changes
[If applicable]
## Related Issues
Closes #123
ā
Small PR: 50-200 lines (ideal)
ā ļø Medium PR: 200-400 lines (ok)
ā Large PR: 400+ lines (split if possible)
ā
Good:
"Consider extracting this into a separate function for better testability"
"This could cause a race condition if called multiple times"
ā Bad:
"This is wrong"
"Why did you do it this way?"
main - Production-ready code
develop - Integration branch for features
feature/* - New features
release/* - Release preparation
hotfix/* - Emergency fixes to production
main - Always deployable
feature/* - All work happens in feature branches
- Create PR to merge into main
- Deploy after merge
# Update feature branch with main
git checkout feature/my-feature
git rebase main
# Interactive rebase (clean up commits)
git rebase -i HEAD~3
# Save work in progress
git stash
# List stashes
git stash list
# Apply stash
git stash pop
git commit --amend
git commit --amend --no-edit
git cherry-pick <commit-hash>
ā Do:
ā Don't: