Recipes
Feature branch flow
Isolate every feature in its own branch, keep main deployable, and ship with confidence using short-lived branches and linear history.
Why it matters
Feature branches let you work on multiple ideas in parallel without stepping on each other. Main stays green, code review is scoped to a single change, and reverting a bad deploy is one click instead of a surgery.
Branch naming
feat/add-2fa-recovery
fix/race-condition-session
chore/upgrade-next-14
docs/api-rate-limitsPrefix with feat/, fix/, chore/, or docs/ so your team and CI know the intent at a glance.
The workflow
- Branch from latest main
git checkout main && git pull && git checkout -b feat/my-thing - Commit small, commit often
Each commit should pass tests locally. Atomic, revertible. - Rebase before opening a PR
git fetch origin && git rebase origin/main — keep history linear. - Open a pull request
Link the issue, add a clear description, request review. - Squash-merge to main
One clean commit per feature. Delete the branch after merge.
Guardrails
- Branches live no longer than 2–3 days. Stale branches rot.
- Never commit directly to main. Ever.
- CI must pass before merge. No exceptions.