Chapter 1 · Practice 2 of 4
Keep main releasable, and revert first when it breaks
Why it matters
Continuous integration only works if main is green almost all the time. DORA's trunk-based guidance says to fix or revert failing changes quickly, so the build stays usable for everyone else.
A simple team rule:
- If main goes red, the person who broke it either fixes it in minutes or reverts.
- Nobody merges on top of a red main.
- Reverting is not a failure; it buys time to fix the change properly on a branch.
Protect main so this is enforced by the platform, not by memory: require pull requests, require the CI checks to pass, and require branches to be up to date (or use a merge queue) so two green pull requests cannot combine into a red main.
To check, look at how long main was red in the last month. More than a few hours in total usually means reverting is too slow or too rare.
Do
- Require passing checks before merge with branch protection
- Use a merge queue when many people merge at once
Avoid
- Merging on top of a failing main because "it is unrelated"