Search Sreeni's Insights

Filter by content type
technical May 21, 2020 9 min read

Trunk-Based Development: The Practice Everyone Praised but Most of Us Still Don't Do

Why trunk-based development remains difficult in enterprise teams, and how feature flags, faster pipelines and culture remove its structural blockers.

Share:

Trunk-Based Development: The Practice Everyone Praised but Most of Us Still Don’t Do


TL;DR: Trunk-based development — committing to main multiple times per day with short-lived branches — is the most recommended and least practiced branching strategy in enterprise engineering. The 2019 State of DevOps Report links it to elite performance. Every DevOps thought leader advocates it. And in 2020, almost nobody in enterprise does it. Teams run Gitflow with 4+ long-lived branches, feature branches that live for weeks, and merge-day rituals that produce 50-file PRs. The gap between advocacy and adoption isn’t ignorance — it’s three structural blockers: missing feature flags, slow pipelines that punish frequent merges, and a culture that uses branches as ownership boundaries instead of integration boundaries.


The 2019 Accelerate State of DevOps Report is clear: trunk-based development is a key predictor of elite delivery performance. Teams that commit to trunk frequently, keep branches short-lived (under a day), and deploy from main outperform teams using long-lived feature branches on every DORA metric — deployment frequency, lead time, failure rate, and recovery time.

Every DevOps conference in 2020 repeats this finding. Every CI/CD best practice guide recommends trunk-based development. Every engineering leader nods approvingly when it’s mentioned.

Then they go back to their teams and continue running Gitflow.


The Insight

The gap between trunk-based development advocacy and trunk-based development adoption is the widest theory-practice gap in DevOps — and it persists because the blockers are structural, not educational.

Teams know trunk-based development is better. They’ve read the research. They’ve attended the talks. They agree in principle. They don’t adopt in practice — not because they disagree, but because their environment makes it impractical.

Three structural blockers prevent adoption. Until all three are addressed, trunk-based development remains aspirational.


The Current Reality

Here’s what branching actually looks like in enterprise teams in 2020:

The Gitflow Default

Most enterprise .NET teams use some variant of Gitflow:

main (production)
├── develop (integration)
│   ├── feature/JIRA-1234-add-sip-mandate (2 weeks old)
│   ├── feature/JIRA-1235-refactor-transaction-service (3 weeks old)
│   ├── feature/JIRA-1236-update-investor-communication-template (1 week old)
│   └── feature/JIRA-1237-fix-login-timeout (4 days old)
├── release/2.4.0 (stabilization branch)
└── hotfix/2.3.1-sip-mandate-fix

Feature branches live for days to weeks. The develop branch accumulates changes until a release branch is cut. The release branch is stabilized (bugs found during testing are fixed on the release branch). Finally, the release branch merges to main and is deployed.

This model was designed for packaged software with infrequent releases. It provides isolation, stability, and control. It also creates:

  • Merge hell. Feature branches that live for 2–3 weeks diverge significantly from develop. The merge back produces conflicts that take hours to resolve and are error-prone.
  • Integration delay. Changes sit on feature branches until “merge day.” Integration problems that would be caught by daily merges accumulate and surface all at once.
  • Large batch sizes. A release branch contains 2–4 weeks of accumulated changes. If something breaks in production, the blast radius is everything in the release — not a single small change.
  • Slow feedback. A developer writes code on Monday. It merges to develop on Friday. It reaches staging the following week. It deploys to production two weeks later. The feedback loop is measured in weeks, not hours.

What Trunk-Based Looks Like

main (trunk)
├── short-lived branch (< 1 day)
├── short-lived branch (< 1 day)
└── short-lived branch (< 1 day)

Developers create branches that live for hours, not weeks. Changes are small — ideally a single commit or a focused set of changes. Branches merge to main multiple times per day. main is always deployable. Deployments happen from main directly.

No develop branch. No release branch. No merge day. No stabilization phase. The integration is continuous because the merges are continuous.


The Three Structural Blockers

Blocker 1: No Feature Flags

Trunk-based development requires merging incomplete features to main. If a feature takes 2 weeks to build, the developer merges work-in-progress code to main daily — code that shouldn’t be visible to users until the feature is complete.

Without feature flags, merging incomplete code to main means deploying incomplete code to production. This is unacceptable for most teams. So they use long-lived feature branches to keep incomplete work isolated from main — and from production.

Feature flags solve this. The code is on main. It deploys to production. But the feature is behind a flag that’s disabled in production. Users don’t see it. The developer continues building the feature on main, behind the flag. When the feature is complete, the flag is enabled. When it’s proven stable, the flag is removed.

// Feature flag pattern — code on main, feature invisible to users
if (featureFlags.IsEnabled("new-sip-mandate"))
{
    // New code — deployed but hidden
    return ProcessSipMandateV2(transaction);
}
else
{
    // Existing code — active in production
    return ProcessSipMandateV1(transaction);
}

Without feature flag infrastructure (LaunchDarkly, Azure App Configuration feature flags, or even a simple config-driven toggle), trunk-based development is impractical. This is blocker #1 — and it’s the most common reason teams stay on Gitflow.

Blocker 2: Slow Pipelines That Punish Frequent Merges

Trunk-based development means merging to main multiple times per day. If the pipeline takes 45 minutes per run, merging 5 times per day means 225 minutes of pipeline time per developer per day. For a team of 8, that’s 30 hours of daily pipeline compute — and if agents are shared, queue waits make it worse.

More critically: if the pipeline takes 45 minutes, a developer who merges at 10am doesn’t know if their change broke something until 10:45am. By then, two other developers have merged on top of their change. If the build is broken, three developers’ work is blocked. The “continuous” in continuous integration becomes “continuously queued.”

Trunk-based development requires fast pipelines. Build + test in under 10 minutes. Deployment in under 5. Total feedback loop: 15 minutes from merge to production. At this speed, merging multiple times per day is natural. At 45 minutes per merge, it’s punishing.

This connects directly to the pipeline optimization work from earlier this month: build time SLAs, parallelized test stages, agent scaling. Those optimizations aren’t just nice-to-haves. They’re prerequisites for trunk-based development.

Blocker 3: Branches as Ownership Boundaries

In many teams, feature branches serve a social function beyond code isolation. The branch is “my space.” The PR is “my submission.” The developer works in isolation on their branch, polishes their code, and presents it for review as a complete, finished unit.

Trunk-based development dissolves this boundary. Changes are small, frequent, and incremental. A PR might be 20 lines — a single function, a single test. The developer doesn’t “finish” a feature and submit it. They contribute a stream of small changes that collectively build the feature.

This requires a cultural shift:

Long-Lived Branch CultureTrunk-Based Culture
PR is a finished productPR is an increment
Code review is a gateCode review is a conversation
Branch is personal workspaceTrunk is shared workspace
”I’ll merge when it’s ready""I’ll merge now, it’s always ready”
Large PRs (20–100+ files)Small PRs (1–20 files)
Merge is an eventMerge is a habit

Teams that are culturally attached to large, polished PRs will resist trunk-based development — not because they disagree with the data, but because the practice conflicts with their working style. This is the hardest blocker to address because it’s behavioral, not technical.


The Adoption Path

Address the blockers in order:

StepInvestmentUnblocks
1. Implement feature flags1–2 weeks for basic infrastructure (Azure App Configuration or config-file toggles)Merging incomplete work to main without exposing it to users
2. Optimize the pipeline2–4 weeks (parallelize tests, split PR vs main pipeline, scale agents)Frequent merges without punishing wait times
3. Shift to small PRsOngoing cultural work (pair programming, PR size limits, lead by example)Continuous integration becomes natural workflow
4. Remove long-lived branches1 day (delete develop, deploy from main)The old model is gone, the new model is the only option

Step 4 is deliberately last. Don’t remove the safety net until the new practices are in place. Teams that delete develop before implementing feature flags will merge unfinished code to production. Teams that mandate small PRs before optimizing the pipeline will drown in queue waits.


The Pragmatic Middle Ground

Not every team needs pure trunk-based development. A pragmatic middle ground for most enterprise teams in 2020:

  • Branch lifetime: < 2 days (not < 1 day, but not 2 weeks)
  • PR size: < 400 lines (not 20 lines, but not 2000)
  • Merge to main: daily (not multiple times per day, but not weekly)
  • Feature flags for incomplete work (not for everything, but for multi-day features)
  • Deploy from main (not from release branches)

This delivers 80% of trunk-based development’s benefits — fast integration, small batch sizes, short feedback loops — without requiring the full cultural transformation that pure trunk-based demands.


The Bottom Line

Trunk-based development is the most praised and least practiced engineering discipline in 2020. The gap isn’t knowledge — it’s structure. Feature flags, fast pipelines, and small-PR culture are prerequisites, not nice-to-haves.

Everyone agrees that trunk-based development is better. The Accelerate data proves it. The industry recommends it. But agreement without action is just consensus — and consensus doesn’t ship code. If your team praises trunk-based development and practices Gitflow, the problem isn’t your branching strategy. It’s the three structural blockers that make the branching strategy impractical. Fix the blockers. The practice follows.


What’s your team’s average branch lifetime? Average PR size? Do you have feature flag infrastructure? If the answer is “weeks,” “hundreds of files,” and “no” — you’re structurally blocked from trunk-based development regardless of how much you want it. Which blocker would your team need to address first?

Related Posts