Skip to main content

Branching Strategies That Scale

intermediate18 min readLesson 93 of 143

Short-lived feature branches, trunks that stay releasable โ€” comparing GitHub Flow, Git Flow, and trunk-based development.

Branching strategy = the team's agreement about where code lives while it is being written.

GitHub Flow (the default for most web teams)

  1. Branch from main for each change: feat/search-filters
  2. Commit small, push, open a pull request
  3. Review + CI must pass
  4. Merge to main, delete the branch, deploy

One long-lived branch (main), everything else short-lived. Ideal for continuously-deployed web apps โ€” and what this course's projects use.

Git Flow

Long-lived main (releases) + develop (integration), with feature/, release/, hotfix/ branches. Powerful for versioned, scheduled-release software (mobile apps, installed products) โ€” heavy for web.

Trunk-based development

Everyone commits to main (or very short branches merged within a day). Incomplete features ship dark, behind feature flags:

if (flags.newCheckout) renderNewCheckout();
else renderLegacyCheckout();

Requires strong tests and CI; eliminates merge pain entirely. Common at high-cadence teams.

Choosing

| Signal | Fit | | ---------------------------- | --------------------------- | | Deploy on every merge | GitHub Flow | | Scheduled releases, versions | Git Flow | | Many engineers, one product | Trunk-based + flags | | Solo project | GitHub Flow, small branches |

Whatever you choose, the rule that matters: branches live short. The longer a branch diverges, the more its merge cost grows โ€” the classic "merge hell" is a symptom of long-lived branches, not of Git.

Now practice

Branch Naming & Flow โ€” PracticeEnforce a branching convention in code: classify branch names, validate a GitHub Flow sequence, and flag long-lived branches.3 challenges ยท ยท ~15 min