# Trunk-Based Development

> The Trunk-Based Development is a version control practice where developers integrate small changes into the main branch frequently.

## What is trunk-based development?

The practice where developers merge small changes into the main branch at least once a day, using short-lived branches. Unfinished features are hidden behind feature flags. Reduces merge conflicts and supports CI/CD.

- Topic: Practices
- Type: approach

## Common mistakes

- Long-lived branches that turn every merge into a big conflict.
- Merging unfinished work without a feature flag, so it shows up for users.

## Key points

- Branches are short-lived and merged into main within a day or two.
- Unfinished features are hidden behind a feature flag before merge.
- CI runs on every pull request to main and must pass before merge.

## Interview questions

### Trunk-based development vs Git Flow: what is the difference?

Git Flow uses long-lived develop and release branches. Trunk-based development keeps one main branch and merges small changes into it often.

### Do I still use pull requests with trunk-based development?

Usually yes. Short-lived branches with quick pull requests keep review while still merging to main often.

### How do I ship half-built features with trunk-based development?

Merge them behind a feature flag that is off for users, then turn it on when the feature is complete.

## Related cards

- [Feature Flags](https://wonderium.dev/processes/feature-flags.md)
- [CI / CD](https://wonderium.dev/processes/ci-cd.md)
- [Branch](https://wonderium.dev/processes/branch.md)
- [Pull Request](https://wonderium.dev/processes/pull-request.md)
- [Merge](https://wonderium.dev/processes/merge.md)

---

- Level: [Processes](https://wonderium.dev/processes.md)
- HTML version: https://wonderium.dev/processes/trunk-based-development
- Last updated: 2026-11-25
