Continuous DeliveryApr 2, 2026

Trunk-Based Development: Why Feature Flags Make It Actually Work

M
Marcus Johnson
Senior Engineer

Long-lived feature branches feel safe. They're not. Every day a branch sits open, it drifts further from main — and every merge is a small gamble that compounds into a big one.

The Real Cost of Branch-Per-Feature

Most teams reach for a feature branch by reflex. It feels like isolation — your work stays contained while the rest of the team moves on. But after a week or two, that branch is a different codebase. Rebasing becomes archaeology. PRs balloon to 2,000 lines. Review quality drops. Conflicts appear in the worst places.

Trunk-based development (TBD) solves this by keeping everyone integrated. Engineers commit small increments directly to main — or at least merge short-lived branches within a day or two. The integration cost is paid continuously, in seconds, rather than in a single painful merge session.

The objection is always the same: "What if we push unfinished work to main and it breaks production?" That's the right question. Feature flags are the right answer.

Flags as Branch Replacements

A feature flag is a branch in your code, not in your VCS. The incomplete feature ships to production, wrapped in a condition that keeps it invisible until it's ready. Your CI pipeline stays green. Main stays deployable. No one else is blocked.

The pattern is straightforward. Using the Featureflow JavaScript SDK:

import featureflow from 'featureflow-client';

const client = featureflow.init('YOUR_API_KEY');

// Wrap incomplete work — ships to prod, stays dark
if (client.evaluate('new-checkout-flow').isOn()) {
  renderNewCheckout();
} else {
  renderLegacyCheckout();
}

The flag defaults to off. Every engineer on the team can pull the latest main, deploy it, and the incomplete checkout flow is just dead code — until someone in Featureflow turns it on. No branch. No merge conflict. No deploy freeze while someone finishes a feature.

The Discipline That Makes It Stick

TBD with flags only works if you treat flags as temporary. Every flag is a debt entry: it must either graduate to permanent config or be removed once the rollout is complete. Teams that skip this step accumulate flags nobody dares touch — which is ironically worse than long-lived branches.

Three rules that keep it clean:

  • Name flags after the feature, not the ticket. new-checkout-flow ages better than JIRA-4821.
  • Set a removal target date when you create the flag. Put it in the description field. Make it a ticket.
  • Review open flags monthly. Any flag older than 90 days with no recent targeting change is a candidate for cleanup.

Featureflow's flag management dashboard makes this easy — you can see creation dates, last-evaluated timestamps, and targeting rules at a glance. Get started at featureflow.com.

Trunk-based development isn't about bravery — it's about discipline. Feature flags are the tool that makes the discipline sustainable. Ship small, integrate constantly, and keep every unfinished feature dark until it's genuinely ready.

The teams who do this rarely have 2am merge nightmares. They also tend to ship a lot faster.

#TrunkBasedDevelopment#FeatureFlags#ContinuousDelivery#DevOps#CI

Ship to main with confidence

Start free with Featureflow — feature flags that keep trunk-based development safe and fast.

Start Now (Free)

Related Articles