# Trunk-Based Development

Trunk-Based Development is a version-control strategy in which developers integrate small changes frequently into a single shared main branch, using direct commits or short-lived branches.

Cloud concept. Updated 2026-10-29. Page: https://blowstack.com/tools/cloud-concepts-hub/trunk-based-development

> The shared trunk remains the authoritative integration point and is kept releasable through automated testing, rapid feedback, and prompt repair of failures. This reduces divergence and large merge conflicts while enabling CI/CD pipelines to promote validated changes consistently across application environments.

Practice exams covering Trunk-Based Development: [DVA-C02 AWS Certified Developer - Associate](https://blowstack.com/practice-exams/aws-certified-developer-associate), [DOP-C02 AWS Certified DevOps Engineer - Professional](https://blowstack.com/practice-exams/aws-certified-devops-engineer-professional).

## 6 key aspects of Trunk-Based Development

Trunk-Based Development combines frequent integration, fast validation, and traceable artifact promotion while keeping release controls separate from branching strategy.

1. **One shared integration branch**: The trunk is the authoritative integration point for ongoing development. Developers merge small changes frequently instead of accumulating work on long-lived feature branches.
2. **Short feedback and review cycles**: Direct commits or short-lived pull requests keep integration delays low. Required reviews and automated checks remain compatible with the approach when they complete promptly.
3. **Continuously validated trunk**: Automated checks validate proposed changes and the integrated trunk revision. A failed trunk build requires prompt repair or reversion so other developers can continue integrating safely.
4. **Artifact promotion rather than environment branches**: Build a versioned artifact from a known commit and promote it across environments. Keep environment differences in deployment configuration and secret management rather than divergent application branches.
5. **Deployment separated from feature release**: Feature flags and compatible incremental changes allow incomplete capabilities to integrate without exposing them to users. Flags need testing, ownership, and eventual removal.
6. **Controlled production delivery**: Approvals, deployment gates, and rollback procedures control production risk without delaying source integration. Frequent merges do not imply that every commit must be deployed immediately.

## Cloud services for Trunk-Based Development

AWS CodeConnections links a supported external repository to CodePipeline, which starts delivery from the configured trunk branch. CodeBuild compiles the selected revision, runs checks, and produces an artifact tied to that commit. CodePipeline carries the validated artifact through environment-specific stages and any required approvals, while CodeDeploy handles deployments to supported targets. AWS AppConfig can control feature exposure independently of those deployments. Together, these services support frequent source integration and controlled release, but the team must still define branch policies, tests, permissions, and artifact traceability.

- **[AWS CodePipeline](https://blowstack.com/tools/cloud-services-hub/aws-codepipeline)**: Orchestrates source, build, test, approval, and deployment stages for changes integrated into the trunk. Configure source triggers and artifact flow so validated output is promoted across environments rather than rebuilt independently.
- **[AWS CodeBuild](https://blowstack.com/tools/cloud-services-hub/aws-codebuild)**: Runs automated builds and tests for proposed changes and merged trunk revisions. It can produce versioned deployment artifacts and report build results that help teams keep the shared branch healthy.
- **[AWS CodeConnections](https://blowstack.com/tools/cloud-services-hub/aws-codeconnections)**: Provides connections between supported external source repositories and AWS developer tools. Used with CodePipeline, it enables a repository hosted outside AWS to supply the trunk revision that starts the delivery workflow.
- **[AWS CodeDeploy](https://blowstack.com/tools/cloud-services-hub/aws-codedeploy)**: Automates deployment of validated revisions to supported compute targets. Deployment strategies and configured rollback behavior help control rollout risk after changes have already been integrated into the trunk.
- **[AWS AppConfig](https://blowstack.com/tools/cloud-services-hub/aws-appconfig)**: Manages feature flags and application configuration independently of application code deployment. It supports gradually enabling integrated features, with configuration validation and monitoring-based rollback when configured.

## Trunk-Based Development exam questions

Real practice exam questions on Trunk-Based Development, with the correct answer and its explanation.

### Question 1 (DVA-C02)

**Question:**

A team stores application code in AWS CodeCommit and uses AWS CodePipeline to test and deploy updates from main. Developers keep feature branches open for several weeks, and conflicts discovered during release preparation frequently delay urgent fixes. A new feature will require six weeks of development, but the team must continue releasing unrelated changes from main throughout that period.

The team wants each developer's changes integrated into the shared release source at least daily. That source must remain deployable, and customers must not have access to the unfinished feature. Which workflow meets these requirements?

**Correct answer:** Merge small, tested changes into main at least daily through short-lived pull requests. Keep unfinished functionality behind a feature flag that is disabled for customers, and validate each resulting main revision before allowing the pipeline to deploy it.

**Explanation:** Frequent integration through short-lived branches reduces divergence. A disabled feature flag separates code integration from customer exposure, while automated validation of the merged main revision helps keep the shared release source deployable.

## Practice Trunk-Based Development in a full exam

Questions on Trunk-Based Development in each practice exam, with every answer option and an explanation for each:

- [DVA-C02](https://blowstack.com/practice-exams/aws-certified-developer-associate): 1 question
- [DOP-C02](https://blowstack.com/practice-exams/aws-certified-devops-engineer-professional): 1 question

## What is Trunk-Based Development

Trunk-Based Development organizes development around one shared integration branch, commonly named main. Developers integrate small changes frequently, usually at least daily, rather than maintaining isolated feature branches for weeks. Teams may commit directly to the trunk or use short-lived branches with lightweight pull requests. The defining characteristic is frequent integration into the shared codebase, not the absence of branches or code review.

Every integration should trigger continuous integration checks. These commonly include compilation, unit tests, static analysis, dependency checks, and selected integration tests. Branch protection can require successful checks and review before merging. Because concurrent changes can interact, the pipeline should also validate the resulting trunk revision after merge. When the trunk fails, restoring it becomes a priority: revert the offending change or deliver a small corrective commit rather than allowing failures to accumulate.

In a cloud delivery workflow, connect the repository to a pipeline and configure its source events to recognize changes to the trunk. Pull-request validation can run separately without deploying unmerged code into shared production environments. A successful trunk build produces a versioned artifact associated with the exact source commit. Promote that same artifact through development, testing, staging, and production instead of rebuilding it separately for each environment. For container workloads, an immutable image digest provides a precise artifact identity.

Application environments do not require corresponding long-lived Git branches. A staging branch and a production branch that continually diverge create additional integration work and can obscure which code was actually tested. Prefer environment-specific deployment configuration, infrastructure parameters, and separately managed secrets. Use pipeline approvals and automated quality gates to control promotion. Trunk-Based Development does not require every merged commit to reach production immediately; continuous delivery can retain an explicit production approval.

For example, a team introducing a new checkout flow can merge its implementation incrementally behind a feature flag. The pipeline tests the code and deploys the artifact to a test account, then promotes it to production after validation. The feature remains disabled until it is ready for users. Flags separate code deployment from feature release, but disabled code still requires testing, and obsolete flags should be removed. Database changes should preserve compatibility during rollout, often by adding a new schema element before migrating consumers and later removing the old element.

The trade-off is a stronger dependency on fast, trustworthy tests, small change sizes, and disciplined collaboration. Slow approvals or unreliable checks encourage branches to live longer and undermine the model. Short-lived release branches can support exceptional maintenance needs, but fixes should also reach the trunk to prevent divergence. For certification scenarios, distinguish this strategy from workflows centered on long-lived development, release, or environment branches: the key signals are frequent integration, a healthy shared mainline, and traceable artifact promotion across environments.

## Learn Trunk-Based Development in lessons

2 short lessons on Trunk-Based Development in 1 certification course.

- DOP-C02: Gitflow vs. Trunk-Based Development (Premium), https://app.blowstack.com/lessons/gitflow-vs-trunk-based-development-dop-c02
- DOP-C02: Trunk-Based Development: a releasable mainline across environments (Premium), https://app.blowstack.com/lessons/trunk-based-development-a-releasable-mainline-across-environments-dop-c02
