← all lessons
Advanced Workflows · lesson 10 of 18

Branching Strategies

Team Workflows

Why it matters

Teams need consistent rules for branching. The right strategy depends on team size, release frequency, and deployment model.

Key concepts

The idea

Three Philosophies

Git Flow: For scheduled releases (e.g., mobile apps, enterprise software)

GitHub Flow: For continuous deployment (e.g., web apps)

Trunk-Based: For high-velocity teams (e.g., Google, Facebook)

Walkthrough

Git Flow

main (production)     ────●────────────────────●────────►
                          ↑                    ↑
hotfix                    │    ●───●           │
                          │        ↓           │
release                   │    ●───●───●───────│
                          ↑        ↑           ↑
develop              ─────●────●───●───●───────●────────►
                              ↑       ↑
feature/a                ●────●       │
feature/b                    ●────────●

Branches:

GitHub Flow

main (always deployable) ────●────●────●────●────●────►
                              ↑    ↑    ↑    ↑
feature branches         ●────●    │    │    │
                              ●────●    │    │
                                   ●────●    │
                                        ●────●

Rules:

  1. Main is always deployable
  2. Branch from main for all changes
  3. Open PR for discussion
  4. Deploy from branch (optional)
  5. Merge after review

Trunk-Based Development

main ────●────●────●────●────●────●────●────●────►
          ↑    ↑    ↑    ↑
         (short-lived feature branches, <1 day)

Requirements:

Comparison

AspectGit FlowGitHub FlowTrunk-Based
ComplexityHighLowMedium
Release cadenceScheduledContinuousContinuous
Branch lifespanLongDaysHours
Best forVersioned releasesWeb appsHigh-velocity teams

Key takeaways

Dos & don’ts

✅ DO

❌ DON’T

Going deeper

Release Branches: Git Flow’s release branches allow stabilization while develop continues. Useful for products with support windows (v1.x vs v2.x).

Feature Flags: Alternative to branching—deploy incomplete code with flags off. Enables trunk-based development without breaking production.

Common mistakes

Long-lived feature branches: The longer a branch lives, the harder merging becomes. If it’s taking weeks, split the feature into smaller pieces.

Develop branch rot: In Git Flow, if develop gets too far ahead of main, release merges become painful. Do regular releases to keep them synchronized.