advanced
Trunk-based development
Integrate small changes frequently behind tests, flags, and CI so main stays deployable.
Trunk-based development integrates small changes into a shared main branch frequently — often multiple times per day. It depends on strong automated tests, fast CI, review discipline, feature flags, and deploy/rollback capability.
| Prerequisite | Why it matters | |--------------|----------------| | Fast CI | Small batches need quick feedback | | Feature flags | Hide incomplete behavior on main | | Branch protection | Main stays releasable | | Observability | Detect regressions after merge |
Developers may use very short-lived branches or commit directly to main with pre-merge review via PR.
On interviews: deployable main, separating code integration from feature release, and when trunk-based beats long-lived GitFlow.
Common pitfalls: trunk-based without tests or flags moves risk straight to production; skipping review because "we trunk now".
The trade-off is integration frequency versus the safety net of longer isolation on branches.
Checklist:
- Integrate small changes frequently.
- Keep main releasable with flags and tests.
- Use CI and branch protection as guardrails.
- Pair with rollback and monitoring, not hope.