Git & Collaboration
Priority: P0 (OPERATIONAL)
1. Write Conventional Commits
- Format:
<type>(<scope>): <description>(e.g.,feat(auth): add login validation). - Types:
feat,fix,docs,style,refactor,perf,test,chore. - Use imperative mood: "add feature" not "added feature".
- One commit = one logical change — no mega-commits.
See implementation examples for conventional commit examples.
2. Manage Branches
- Name with prefixes:
feat/,fix/,hotfix/,refactor/,docs/. - Create new branch for every task to keep main stable and deployable.
- Never push directly to
mainordevelop— use Pull Requests. - Pull before you push to resolve conflicts locally.
- Prefer
git rebaseover merge for linear history on feature branches. - Use
git rebase -ito squash messy commits before pushing.
3. Submit Quality Pull Requests
- Limit to < 300 lines of code for effective review.
- State what changed, why, and how to test. Link issues (
Closes #123). - Self-review for obvious errors before requesting peers.
- PRs must pass all CI checks (lint, test, build) before merging.
4. Protect Secrets and Metadata
- Never commit
.env, keys, or certificates — use.gitignorestrictly. - Use
huskyorlefthookfor local Git Hooks enforcement. - Tag releases with SemVer (
vX.Y.Z) and updateCHANGELOG.md.
Anti-Patterns
- No direct push to main: All changes via PR, no exceptions.
- No mega-commits: One commit = one logical change. Split large ones.
- No secrets in history: Use
git filter-repoto purge; rotate secret.