{"canonical_url":"https://engineer.company/glossary/trunk-based-development/","content_markdown":"# Trunk-based development\n\n## What it is\n\nTrunk-based development is a way of integrating software changes frequently on a\nshared mainline. Contributors make small changes that can be reviewed and\ncombined quickly. They may work directly on the shared line under its controls\nor use short-lived branches before merging. The central idea is to keep the\ninterval between building a change and checking it against the current shared\nproduct small enough that integration is routine.\n\nThe trunk is where contributions are brought together. It usually has agreed\nentry checks and a way to identify a coherent version of the code. A feature can\nbe developed over several steps and remain unavailable to users until it is\nready. A feature flag, configuration or other product boundary can separate\nintegrating a safe implementation step from releasing the complete experience.\n\nShared integration still needs explicit release practices. A team may build an\nartefact from the trunk and promote that exact artefact through environments.\nRelease tags or short-lived release branches can serve products that support\nmore than one version. The meaningful question is how long independent\ndevelopment remains separated from the shared line and how quickly a change can\nbe checked with everyone else's work.\n\n## Why it matters\n\nLong intervals between integrations can hide interactions. One team can change a\nrepresentation while another team builds a feature against the earlier shape.\nBoth branches may pass their own checks. When they finally meet, the two teams\nhave to diagnose the change and its consequences at once. Smaller, frequent\nintegrations give the teams feedback closer to the decision that caused it.\n\nSmaller changes can also improve recovery. A release with a clear sequence of\ncommits allows an operator to trace a defect to a decision and choose a bounded\ncorrection. The history needs meaningful descriptions and an artefact that can\nbe traced back to it. Several small commits can still be hard to interpret if\nthey leave intermediate states that make no sense outside a developer's own\nbranch.\n\nA team has to make routine integration easy enough to sustain. Slow or\nunreliable checks can encourage contributors to accumulate changes while\nwaiting. Review work can also queue for people whose approval is normally\nrequired. Measure time spent waiting for integration, organise review ownership\nand make common checks reproducible. Frequent merging works when each change is\nsmall enough to evaluate and the shared line continues to carry a usable\nproduct.\n\n## What it looks like in practice\n\nImagine a team adding a new report format. The first change introduces an\ninternal representation that works with the current report. The second adds a\nrenderer that can be exercised in tests. A later change exposes a control to\nselected readers. Each step can be reviewed and integrated while the existing\nroute continues operating. The feature's visible release has an explicit check\nand can happen after its constituent changes are combined.\n\nSet the shared checks around actual compatibility. Cover the old public signal\nduring each transition, run representative tests against the candidate build,\nand record which artefact contains a change. A failing check should tell the\ncontributor how to reproduce it. If a change must be separated before\nintegration, establish the small part of the work it protects and integrate it\nonce that condition is satisfied.\n\nEngineer's\n[repository history standards case study](/portfolio/held-4-repositories-to-one-history-standard/)\nrecords common commit-message and documentation rules enforced by hooks across\nfour repositories. That gives a concrete example of making a shared standard\nobservable in tooling. A reviewable trunk can apply the same discipline to its\nentry controls and commit history. Contributors can see what changed, which\nprerequisite was checked and how to investigate a result.\n\nInclude a recovery drill. Pick a small change whose behaviour differs in the\nshared build and follow the revision through the release artifact. Decide how\nthe team would restore the previous behaviour through a safe follow-up or the\nrelease process. A database change can require separate compatibility planning.\nRegular integration makes these choices visible sooner when it keeps changes\nsmall and supports actual recovery.\n\n## Where it goes wrong\n\nA short-lived branch can still contain a change too large to review or release\nsafely. Choose a change with a clear purpose and an observable result that can\nbe checked promptly. A useful step adds one observable behaviour or prepares a\nclearly described later step. Exercise the application between steps and make\nsure a delayed follow-up leaves an acceptable result.\n\nThe time to integrate a small change is a useful signal when it regularly\nexceeds the time to make it. Aggregate where it spends that time and review\nwhich checks found real disagreements. A check can protect a shared contract\nwhile still needing better fixtures or earlier feedback. A reproducible failure,\na clear owner and a small repair can help a team retain both the control and the\nintegration habit. Watch for repeated idle time spent waiting for the same\ndependency.\n\nFeature flags can accumulate and turn temporary states into a complicated\nproduct. Give a flag an owner, a testing policy for the supported states and a\ncondition for removing it. When two flags affect the same route, identify which\ncombinations must work during rollout. An integration check can show an\nunintended interaction before the feature is broadly visible.\n\nFinally, make the trunk's health visible beyond the merge button. Watch whether\nthe source actually builds, how recently there was a good artefact and whether a\nnew revision progresses through the relevant release checks. A team should be\nable to explain what a green result certifies. Frequency helps when each\nintegration produces evidence people can act on and a shared version they can\nreliably move forward from.\n\n## Further reading\n\n- [DORA on trunk-based development](https://dora.dev/capabilities/trunk-based-development/).\n  Describes frequent small integrations and related delivery measures.\n- [Trunk-Based Development](https://trunkbaseddevelopment.com/). Documents\n  branch and release arrangements used with the practice.\n- [GitHub protected branches](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-protected-branches/about-protected-branches).\n  Explains controls for a shared branch.\n\n\u003chttps://engineer.company/glossary/trunk-based-development/\u003e\n","date_modified":"2026-11-25T07:18:46Z","description":"See how short-lived changes reach a shared mainline, how review fits and how unfinished work stays out of a release.","formats":{"gemtext":"https://engineer.company/glossary/trunk-based-development/index.gmi","gopher":"https://engineer.company/glossary/trunk-based-development/gophermap","html":"https://engineer.company/glossary/trunk-based-development/","json":"https://engineer.company/glossary/trunk-based-development/index.json","markdown":"https://engineer.company/glossary/trunk-based-development/index.md","pdf":"https://engineer.company/glossary/trunk-based-development/index.pdf"},"kind":"page","language":"en","title":"What is trunk-based development?","url":"https://engineer.company/glossary/trunk-based-development/","version":1}