XenonStack

Deployment Automation

XenonStack Insights Trunk-Based Development: Guide for Engineering Leaders

and | Published | Updated

Trunk-Based Development: stack from fast tests and review up to a releasable trunk, with short-lived branches and feature flags

Key takeaway

  • Trunk-based development explained: how it works, how it differs from Gitflow, what DORA recommends, and when to adopt it with AI coding agents.

Trunk-based development is a branching model in which every developer integrates small changes into one shared branch, the trunk (usually called main), at least once a day. It replaces long-lived feature branches with short-lived ones, so work is merged while it is still small and easy to review.

For engineering leaders the practical question is not whether the model works at Google scale but whether your tests, review habits and release controls are strong enough to support it. This guide explains how it works, how it differs from Gitflow-style workflows, and when to choose each. Sources are trunkbaseddevelopment.com and DORA, read in November 2026.

What is trunk-based development?

According to trunkbaseddevelopment.com, it is a source-control branching model where developers work in one main branch and avoid long-lived development branches, using documented techniques to avoid merge problems and keep the build unbroken. DORA describes it as splitting work into small batches and merging into trunk "at least once (and potentially several times) a day", and treats it as a required practice for continuous integration.

Two-column diagram pairing branching practices (long-lived branch, short-lived branch, incomplete feature, release preparation) with controls (daily merge, review, feature flag, release from trunk).

The old name for the trunk was "master". The same site notes that Git has used "main" since 2020, so both names refer to the same idea.

How does it differ from feature-branch workflows such as Gitflow?

AspectLong-lived feature branches (for example Gitflow)Trunk-based development
Branch lifeDays or weeks, often with several developers (DORA)Hours to a couple of days (DORA; trunkbaseddevelopment.com)
IntegrationOne large merge when the feature is completeSmall, frequent merges to trunk
ReviewPull request on a large changePull request on a small change, or pairing, with review inside the branch's short life
Incomplete workStays on the branchMerged but switched off with a feature flag
ReleasesSeparate release and hotfix branchesRelease from trunk, or cut a short-lived release branch just in time
Main riskPainful, late mergesA broken trunk if tests and review are weak

How is trunk-based development implemented?

For small teams

trunkbaseddevelopment.com says very small teams may commit directly to trunk after a local build and test.

For larger teams (scaled trunk-based development)

Larger teams use short-lived feature branches and pull requests. The site says such a branch should last "only a couple of days", belong to one developer (or two when pairing), and be integrated after a prioritised code review. Time spent waiting for review counts towards the branch's short life. The site also says the point at which a team moves from small to scaled is "subject to practitioner debate", so do not look for a fixed team size.

  1. Branch from trunk and keep the change small.
  2. Run the build and tests locally, then push.
  3. Get a prompt review and let the pipeline run.
  4. Merge to trunk and delete the branch.
  5. Hide unfinished work behind a feature flag.

What does DORA say about it?

DORA's capability page sets three targets: three or fewer active branches in the repository, merging at least daily, and no code freezes or integration phases. It reports that teams achieve higher software delivery and operational performance when they follow these practices, based on its 2016 and 2017 State of DevOps data. Treat that as an association found in survey data, not proof that the branching model alone causes the result. Measure your own delivery metrics before and after a change.

What are the benefits?

  • Fewer painful merges. Small, frequent integration means conflicts surface while they are still small.
  • Continuous integration in practice. CI needs everyone to commit to trunk at least once every 24 hours, according to trunkbaseddevelopment.com.
  • Visibility. Everyone sees the same code, so duplicated work and drift appear early.
  • Faster, safer release decisions. Because trunk is kept releasable, you can release from it or cut a short-lived release branch when needed.

Which practices make it work?

  1. Keep branches short and small, and delete them after merging.
  2. Merge only after the build and tests pass; keep the trunk green.
  3. Use feature flags for unfinished work. The site advises placing code behind an abstraction, testing the meaningful flag combinations in CI, and giving each flag a "review for delete" date because flags are often forgotten.
  4. Use branch by abstraction for larger changes, as recommended on the site.
  5. Release from trunk and "fix forward", or cut a release branch just in time, harden it and delete it afterwards.
  6. Avoid code freezes (DORA).

When should you not use it, or adopt it gradually?

SituationGuidance
Weak or slow automated testsFix the test suite first; frequent merges with weak tests put defects straight onto trunk.
Review takes daysShorten review turnaround or use pairing, otherwise branches stop being short-lived.
Many junior contributors or external contributorsKeep pull requests and review, with short branches. Do not drop review to hit a merge target.
Packaged products with several supported versionsYou may still need maintained release branches; keep them short in scope.

Who uses it?

According to trunkbaseddevelopment.com, Google practises it in a monorepo with 35,000 developers and QA automators, and Facebook practises it at scale. We have not verified these figures independently.

How does it fit AI-assisted and agentic coding?

The site now applies the same rule to coding agents: keep each agent's change small, and treat the unit as one developer and their agents. DORA's 2025 report describes AI as an amplifier that magnifies an organisation's existing strengths and weaknesses. Small changes, fast tests and clear review are therefore the controls that decide whether agent-written code helps or hurts. See our guide to developer productivity with agentic AI and continuous testing. For governed agent workflows, ElixirClaw is an agentic OS platform to build, orchestrate and govern AI agents and automation workflows while keeping humans in control, and AgentGRC keeps autonomous agent actions inside policy, with the audit trail risk teams need.

What should leaders do next?

  1. Measure current branch lifetime and the number of active branches.
  2. Set a target of daily merges and no more than three active branches (DORA).
  3. Strengthen tests and review turnaround before cutting branch life.
  4. Introduce feature flags with an owner and a removal date.

If agents will write or merge code in your pipeline, decide which merge decisions they may make and what policy they depend on. To map one such decision, book a Context Workshop. See what happens in the workshop.

FAQ

What is trunk-based development in one sentence?

Developers merge small changes into one shared main branch at least once a day instead of working on long-lived feature branches.

Can you still use feature branches?

Yes, if they are short-lived. trunkbaseddevelopment.com says such a branch should last only a couple of days and belong to one developer, or two when pairing.

How do you ship unfinished work?

Merge it behind a feature flag so the incomplete path stays inactive in production, and remove the flag when it is no longer needed.

What does DORA recommend?

Three or fewer active branches, merging at least daily, and no code freezes or integration phases.

Is it right for every team?

No. It depends on reliable automated tests and fast review. Where those are missing, build them first and adopt the model gradually.

Does it help with AI coding agents?

Its core rule, keep each change small, applies directly to agent-written code, according to trunkbaseddevelopment.com.

Table of Contents

navdeep-singh-gill

Navdeep Singh Gill

Global CEO and Founder of XenonStack

LinkedIn profile

Navdeep Singh Gill is serving as Chief Executive Officer and Product Architect at XenonStack. He holds expertise in building SaaS Platform for Decentralised Big Data management and Governance, AI Marketplace for Operationalising and Scaling. His incredible experience in AI Technologies and Big Data Engineering thrills him to write about different use cases and its approach to solutions.

Get the latest articles in your inbox

Subscribe Now

Interested in Solving your Challenges with XenonStack Team
Get Started

Get Started with your requirements and primary focus, that will help us to make your solution

Please Select your Industry
Banking
Fintech
Payment Providers
Wealth Management
Discrete Manufacturing
Semiconductor
Machinery Manufacturing / Automation
Appliances / Electrical / Electronics
Elevator Manufacturing
Defense & Space Manufacturing
Computers & Electronics / Industrial Machinery
Motor Vehicle Manufacturing
Food and Beverages
Distillery & Wines
Beverages
Shipping
Logistics
Mobility (EV / Public Transport)
Energy & Utilities
Hospitality
Digital Gaming Platforms
SportsTech with AI
Public Safety - Explosives
Public Safety - Firefighting
Public Safety - Surveillance
Public Safety - Others
Media Platforms
City Operations
Airlines & Aviation
Defense Warfare & Drones
Robotics Engineering
Drones Manufacturing
AI Labs for Colleges
AI MSP / Quantum / AGI Institutes
Retail Apparel and Fashion

Proceed Next