Workflows
Trunk-Based Development Workflow
Keep main continuously releasable by using short-lived branches, frequent integration, and small merge batches.
- Teams turning commands into repeatable routines
- Readers who need sequencing, branch, and sync discipline
- Basic understanding of fetch, pull, push, and branches
- A sense of how and why branches diverge
- Copying a workflow without checking branch state
- Choosing the wrong integration path on shared branches
Data & Performance
- ≤ 1 daybranches live less than a day in pure trunk-based development, minimizing merge conflict surfaceSource: trunkbaseddevelopment.com
Key Quotes
Trunk-based development is a source-control branching model where developers integrate their work to a single shared branch (the trunk) at least once a day, keeping branches short-lived.
Citations & Further Reading
- Git Branching Branching Workflows [Book]
- Git rebase [Official]
- Git merge [Official]
- Git worktree [Official]
What you will learn
- Understand the core purpose of Trunk-Based Development Workflow
- Master the basic usage and common options of Trunk-Based Development Workflow
- Keep main continuously releasable by using short-lived branches, frequent integration, and small merge batches.
- Understand key concepts: What this workflow solves
- Know when to use this feature and when to avoid it
Trunk-based development is not “no branches.” It is a discipline: keep branches short-lived so main stays integratable, recoverable, and releasable.
Start with a problem
Your team is collaborating on a project, branches are growing, merges are becoming more frequent — but there's no stable collaboration rhythm. Everyone syncs code their own way, and conflicts are piling up.
What this workflow solves
Long-lived branches often create:
- heavy integration conflicts late in the cycle
- CI confidence that is true only inside one branch
- oversized merge sets that are hard to review and rollback
TBD spreads integration risk into smaller, earlier steps.
Best-fit scenarios
- many developers are changing the same repository daily
- the team wants “release anytime” behavior from main
- large initiatives can be decomposed into mergeable increments
If your process still relies on long isolated development phases, TBD benefits will be limited.
Recommended operating sequence
1. Branch from fresh main
git fetch origin
git switch main
git pull --ff-only origin main
git switch -c feature/login-copy-tuning
2. Move in small commit batches
git add -p
git commit -m "tune login copy tone"
Each commit should remain explainable, reviewable, and reversible.
3. Sync with main before merge
git fetch origin
git rebase origin/main
If your team avoids branch rebasing, update base through the platform merge flow instead.
4. Review and merge quickly
The key is reducing time-to-merge, not letting branches age for days.
How TBD differs from GitFlow
- GitFlow emphasizes multiple long-lived branches
- TBD emphasizes one trunk, short branch lifetime, and frequent integration
Neither is universally superior. They serve different organizational rhythms.
You still need review, CI, and release guardrails. TBD changes integration timing and granularity, not quality standards.
Three rollout risks teams underestimate
- Work items are not sliced small enough
- CI latency is too high to support fast integration
- Rollback practice is weak even though merge speed is high
Common mistakes
Mistake 1: short branches automatically mean high quality
Short branches reduce integration friction; they do not replace quality gates.
Mistake 2: every branch must merge within one day
Complex work can merge incrementally behind flags without exposing unfinished behavior.
Mistake 3: TBD removes the need for release strategy
Higher merge frequency usually requires clearer versioning and rollback policy.
- Pick a recent large feature.
- Split it into 3 to 6 independently mergeable slices.
- Define the minimum rollback unit for each slice.
- Verify each slice can pass CI independently on main.
Good follow-up reads
Try it yourself
- Practice the trunk-based-development-workflow command in a test repository and observe state changes before and after
- Experiment with different options and compare the output differences
- Simulate a real scenario where you would need to use this, and walk through the full process
Further reading
Keep going on the same topic: