Overview
- Version control management practice—Git
- Developers merge small, frequent updates to main “trunk” branch
- No long-lived branches e.g. GitFlow
- Less complex to manage
- More suited to CI
- Trunk always assumed to be stable
Benefits
- Continuous integration
- Requires automated tests, code coverage monitoring, reviews
- Continuous code reviews
- More efficient—smaller changes
- Consecutive production code releases
- Frequent daily merges to main branch
- Keep trunk “green”—ready to deploy
- Agility—daily prod releases
Best Practices
- Develop in small batches
- A few lines of code per commit
- Lower cognitive overhead, faster decisions
- Feature flags
- Reduces need for feature branches
- Comprehensive automated testing
- Asynchronous code reviews
- Fewer than three active branches
- Delete branches once merged
- Merge branches to trunk at least once per day
- Tag main branch at end of day as release
- Reduce number of code freezes and integration phases
- Build fast and execute immediately
- Optimize build and test execution times
- Leverage caching layers in CI/CD
References