Keep each integration small and independently safe
How small, frequent integrations, merge validation, and prompt failure repair keep trunk releasable so pipelines can promote the same commit-linked artifact across environments. · advanced
Trunk-Based Development keeps one shared integration branch, usually main, close to a releasable state. Integrate small changes frequently, using direct commits or short-lived reviewed branches. A small change reduces the amount of code that must be understood, validated, and potentially reverted together. Merely naming a branch main does not provide this property: long review queues and large batches still delay integration.
Releasable does not mean every feature is complete or every commit must immediately reach production. Split unfinished work into compatible increments and use feature flags to keep incomplete behavior unavailable to users. Deployment installs code; release exposes behavior. A disabled path still needs testing, including its interactions with enabled paths, and obsolete flags should be removed.
Compatibility also matters outside application code. For database changes, use expand–migrate–contract: introduce a compatible schema addition, migrate consumers and data, then remove the old structure only when nothing still needs it. This supports incremental integration and mixed application versions during rollout; a flag alone cannot make an incompatible schema change safe.