• Home
  • BVSSH
  • Engineering Enablement
  • Playbooks
  • Frameworks
  • Good Reads
Search

What are you looking for?

Aug 07, 2024 Ragan McGill Sooner
Feature Toggles and Trunk-Based Development: Shipping Faster with Confidence

Imagine this: your team merges code into the main branch multiple times a day. Every change is integrated, tested, and deployed rapidly. You’re releasing features to production without the stress of big-bang launches or the risk of lengthy release freezes. Sound too good to be true?

It isn’t. It’s exactly what becomes possible when you combine feature toggles with trunk-based development.

These two practices - when used thoughtfully - are transformative. They decouple deployment from release, reduce merge conflicts, improve flow, and give teams the ability to ship code faster without sacrificing stability.

This isn’t about moving recklessly. It’s about creating an environment where delivery is continuous, risk is controlled, and confidence is high.

Let’s break it down.


What Is Trunk-Based Development?

Trunk-based development is a source control strategy where developers work in small, short-lived branches (or even directly on main) and integrate changes frequently - often several times a day.

It avoids the pain of long-lived feature branches, tangled merges, and last-minute integration surprises. Instead of delaying integration until the end, it happens constantly.

Key principles:

  • Merge early, merge often

  • Keep branches short-lived (hours or a day - not days or weeks)

  • Maintain a healthy, always-releasable main branch

  • Use continuous integration to catch issues fast

But here’s the catch: in a traditional setup, this fast-moving model can feel risky if your feature isn’t finished. That’s where feature toggles come in.


What Are Feature Toggles?

Feature toggles (also known as feature flags) are a way to control whether a piece of functionality is turned “on” or “off” at runtime - without changing the code or redeploying.

They let you:

  • Merge incomplete features without exposing them to users

  • Gradually roll out features to a subset of users

  • Instantly disable a feature if issues occur

  • Run A/B tests or collect data before going fully live

Feature toggles act as guardrails for fast, iterative development. They reduce the risk of breaking things in production - and make it safe to move quickly.


Why This Combo Works So Well

Trunk-based development solves the integration problem. Feature toggles solve the exposure problem.

Together, they:

  • Enable continuous delivery while keeping the system stable

  • Eliminate long-lived branches that increase merge risk

  • Give teams flexibility to control when (and to whom) features are released

  • Support test-driven and hypothesis-driven development

  • Reduce cycle time, allowing for faster feedback and iteration

In short, you ship code when it’s ready to integrate - not when it’s ready to go live.


Common Anti-Patterns to Avoid

While powerful, these practices need to be implemented carefully. Watch out for:

  • Toggle sprawl: Too many unmanaged feature flags clutter code and cause confusion. Use naming conventions and clean-up strategies.

  • Permanent toggles: Toggles meant to be temporary shouldn’t become technical debt. Remove them once a feature is fully released.

  • Poor test coverage: Don’t rely on toggles as a crutch. All toggle states should be tested in CI pipelines.

  • Overly long branches in disguise: Even with toggles, keeping code unmerged for days defeats the purpose of trunk-based development.

Discipline and clarity matter.


Getting Started: Practical Tips

If you’re moving toward trunk-based development with feature toggles, start small:

  • Pick the right tools: Use feature flagging tools like LaunchDarkly, Unleash, or simple config-driven toggles.

  • Define flag ownership: Every flag should have an owner and an expiry plan.

  • Automate toggle clean-up: Build scripts or dashboards to track unused or stale flags.

  • Train the team: Pair knowledge of trunk-based development with a culture of clean toggling and CI/CD best practices.

  • Review toggle usage in code review: Treat toggles as part of the feature implementation, not an afterthought.


The Payoff

Teams that embrace trunk-based development and feature toggles report:

  • Higher deployment frequency

  • Reduced change failure rate

  • Faster rollback or mitigation of issues

  • Greater confidence in experimentation

  • Less time wasted on painful merges

It’s a leaner, safer, and more modern way to build software. And once you experience it, there’s no going back.


Final Thought

Engineering maturity isn’t about delivering the most - it’s about delivering with purpose, safety, and speed.

Feature toggles and trunk-based development don’t just accelerate delivery. They give teams the ability to move fast without breaking things - to release continuously, reduce risk, and innovate with control.

It’s not about reckless speed. It’s about reliable momentum.

And in digital engineering, that’s the true competitive edge.

Ragan McGill

Engineering leader blending strategy, culture, and craft to build high-performing teams and future-ready platforms. I drive transformation through autonomy, continuous improvement, and data-driven excellence - creating environments where people thrive, innovation flourishes, and outcomes matter. Passionate about empowering others and reshaping engineering for impact at scale. Let’s build better, together.

Popular posts
  • Designing for Trust - Why SLOs, Error Budgets, and Toil Matter in Platform Engineering
    Jun 03, 2025
  • Platform Antipatterns - When Good Intentions Go Wrong
    May 29, 2025
  • Platform as a Product - Building Trust, Not Just Tools
    May 27, 2025

Technical debt is like junk food - easy now, painful later.

Awesome Blogs
  • LinkedIn Engineering
  • Github Engineering
  • Uber Engineering
  • Code as Craft
  • Medium.engineering