After this lesson, you will be able to: Compare Git Flow, trunk-based development, and feature-flag-driven workflows, and pick the right one for a given team and product.
Branching strategy is the most-debated and least-thought-about part of Git. This lesson maps the three modern approaches and the contexts where each shines.
Five branch types: main, develop, feature/*, release/*, hotfix/*. Releases cut from develop, hotfixes land on main and back-merge. Designed for shrink-wrapped software with quarterly releases (Vincent Driessen, 2010). Still common in regulated industries (banks, healthcare) where releases batch deliberately. Overkill for most web products today.
One long-lived branch (main / trunk). Every change goes through a short-lived feature branch (1-3 days max) that merges back to trunk via PR. Releases are tags on trunk, deployed via CI/CD. Used at Google, Facebook, Netflix, most modern SaaS. Trade-off: requires good test automation and feature flags to merge half-finished work safely.
Instead of long-lived branches, merge code behind a flag that controls whether the feature is enabled. New code ships dark; you flip the flag to enable for 1%, 10%, 100% of users. Tools: LaunchDarkly, GrowthBook, GitHub Actions environments, Vercel feature flags, or a simple `if (process.env.NEW_FEATURE)` for small teams. Lets trunk-based development handle multi-week features without long-lived branches.
Boring is good. The pattern works for any size project.
// src/flags.tsexport const flags = {newCheckout: process.env.FLAG_NEW_CHECKOUT === "true",experimentalRag: process.env.FLAG_EXPERIMENTAL_RAG === "true",} as const;// usageimport { flags } from "@/flags";if (flags.newCheckout) {return <NewCheckout />;}return <LegacyCheckout />;// For per-user gating, swap process.env for a function that// checks the user's GrowthBook / LaunchDarkly attributes. The// caller code stays the same shape.
Solo / very small team: trunk-based with optional feature branches. No process overhead. Mid-size product team (5-50 engineers): trunk-based + feature flags. The web-product default. Regulated / shrink-wrap / monthly+ release cycle: Git Flow or a variant. The release branches map to compliance gates. Whatever you pick, document it in CONTRIBUTING.md so new hires don't guess.
Letting feature branches live for weeks. Merge conflicts grow exponentially with time. Using Git Flow at a startup. The ceremony slows you down without buying anything you need. Trunk-based without feature flags and without CI tests. You'll ship half-finished features and break trunk regularly. Flag cleanup never happens. Schedule a quarterly flag-removal sprint or flags become permanent dead code.
Pick the modern default.
Sign in and purchase access to unlock this lesson.