Git Workflows 2025: Trunk-Based Development Is the Answer
Contents
Why GitFlow Is Outdated
GitFlow problems:
- too many branches, painful merges
- long-lived branches, integration nightmare
- CI/CD unfriendlyTrunk-Based Development
# rule: all features via short-lived branches
git checkout -b feature/user-auth main
# write code
git commit -m "feat: add auth"
git push origin feature/user-auth
# create PR
# delete branch after mergeFeature Flag
if flag.IsEnabled("new-checkout") {
// new code
} else {
// old code
}CI/CD Integration
on:
push:
branches: [main, 'feature/*']Conclusion
TBD + Feature Flag = modern dev节奏.