Skip to content

Trunk-based development or feature branches: what changes when agents write code

Short-lived branches merge often and reduce conflicts; long-lived branches pile up risk. How each fits a team that uses coding agents.

Published by Contextingo.

Two branching styles dominate. In trunk-based development, everyone merges small changes to one main branch at least daily. With feature branches, work lives on a branch until a feature is complete.

Comparison

Trunk-basedLong feature branches
Merge sizeSmallLarge
ConflictsFew, earlyMany, late
Release controlFeature flagsBranch merges
ReviewFrequent, smallInfrequent, large
Fit with agentsGoodRisky

Why agents push towards short branches

  • Agents write quickly, so a branch can drift far from main in a day.
  • Large diffs are hard to review.
  • Several agents working at once make conflicts likelier.

A middle path

  1. One issue per branch, merged within a day or two.
  2. Use feature flags for work that takes longer.
  3. Rebase or merge main into the branch daily.
  4. Protect main with required checks and a review.

See feature flags for agent changes, small pull requests and git worktrees.

Questions

Good to know.

Do I need to adopt trunk-based development?

No. Keep branches short and merge often, whatever you call it.

What about release branches?

They can coexist: main stays the place where work lands.

Nothing learned is lost. Nothing unchecked is done.