intermediate
Feature branches
Use short-lived feature branches to isolate work without letting integration drift become expensive.
Feature branches isolate a change for development and review. They work best when **short-lived**, regularly synced with main, and backed by CI on every push.
main ─────●─────●─────●─────●
\ /
feature ●─●─●─●
Sync frequently via merge or rebase to shrink the final integration diff. For incomplete behavior shipped to production, use feature flags — branches are not deployment controls.
On interviews: compare feature branches with trunk-based development; mention flags, PR size, and integration frequency.
Common pitfalls: months-long branches with surprise conflicts; treating the branch as a permission to skip CI; multiple unrelated features on one branch.
The trade-off is isolation (separate branch) versus continuous integration (small merges to main).
Checklist:
- Keep branches small and short-lived.
- Sync with main at least daily on active work.
- One feature or fix per branch when possible.
- Use flags to decouple merge from user-visible release.