Last Updated: May 1, 2025
Core Practices
| Item | Description |
|---|---|
Short-Lived Branches | Branches exist for hours, not days — merge to main at least daily |
Small Commits | Each commit is small, atomic, and passes all tests |
Feature Flags | Incomplete features ship to production behind toggles |
Comprehensive Testing | Fast test suite runs on every commit before merge |
Code Review | Every commit is reviewed — pair programming counts as review |
Continuous Deployment | Main is always deployable — deploy multiple times per day |
No Long-Running Branches | No develop, no release branches — just main |
Release Tags | Tag specific commits on main for release identification |
Branch Workflow
git checkout -b short-fix mainCreate very short-lived branch from main
git commit -m 'Fix: correct validation logic'Small, focused commit
git fetch origin main && git rebase origin/mainRebase on latest main before merging
git push -u origin short-fixPush and open PR immediately
gh pr create --fillCreate PR with auto-filled description
gh pr merge --squash --delete-branchSquash merge and clean up branch
git checkout main && git pullUpdate local main after merge
git branch -d short-fixClean up local branch
Feature Flags
| Item | Description |
|---|---|
Launch Darkly | Managed feature flag service with targeting and analytics |
Environment Variables | Simple flags via env vars: FEATURE_NEW_UI=true |
Config File Flags | YAML/JSON config flags for moderate complexity |
Trunk-Based + Flags | Ship code immediately; enable feature when ready |
A/B Testing | Use flags to roll out features to percentage of users |
Kill Switches | Emergency flags to disable features without redeploying |
Flag Cleanup | Remove flag code after feature is fully rolled out and stable |
Operators | Per-team, per-user, percentage-based, and date-scheduled rollouts |
TBD vs Other Models
| Aspect | Trunk-Based | GitHub Flow | GitFlow |
|---|---|---|---|
| Branch Lifespan | Hours | Days | Weeks to months |
| Main Branches | 1 (main) | 1 (main) | 2 (main + develop) |
| Release Cadence | Continuous | Continuous | Scheduled |
| Merge Frequency | Daily+ | Every few days | When feature complete |
| Complexity | Low | Low | High |
| Best For | CI/CD, DevOps | Web apps, SaaS | Mobile, packaged software |
Pro Tip: The key to TBD is small, frequent merges. If your branches live more than a day, you're doing it wrong. Pair with feature flags for incomplete work.