15.10 After the merge
- Approved by
- Panaversity ·
In everyday life. A restaurant adds a new dish to the kitchen's recipe book on Monday, but puts it on the menu only on Thursday. It offers it first to one table of regular customers, and keeps the old dish ready in case the new one fails. Adding the recipe, offering it, and serving it to everyone are three separate decisions.
What you will learn. How to get a merged change to its users in separate steps, and how to have the agent rehearse the way back.
Why it matters. A merged change is not yet delivered, and a mistake after the merge reaches real users and real money.
What is left after the merge?
Delivery. Review decides whether a change may join main. The change still has to reach production, the place where the code runs for real users and real money. That step is often the slowest.
As at the restaurant, each step is its own decision. Figure 15.16, at the end of this lesson, shows four stages:
- Merged. The code is on
main. This is the recipe in the book. - Deployed. The merged code runs in production, with the new behavior still off. The kitchen has the recipe, and the dish is not on the menu.
- On for a small group. A staged rollout turns the new behavior on for a few users first, and watches what happens. It is the one table of regular customers.
- On for everyone.
What changes when the weekend rule merges?
Nothing, until someone turns it on. The weekend rule merges with a setting, PAY_WEEKEND_RULE, that is off. Here is the last line of the Friday list on main after the merge. The first run leaves the setting alone. The second turns it on for that one run.
8 invoices, total $19,229.53
10 invoices, total $33,109.53The first line is Friday's list as before. The code is merged, and Brightline still pays the same eight invoices.
What does a feature flag do, and what does it not do?
It keeps merging apart from turning on. A setting like PAY_WEEKEND_RULE is a feature flag: it turns new behavior on or off without changing the code. It is the restaurant's menu. The recipe is in the book, and the dish is not offered yet.
What it does. With the flag off, the code is on main, where it is reviewed, tested and kept up to date. Turning the flag on is a separate decision, by the person who owns the policy.
What it does not do. It does not remove the risk of the merge. A new package, a change to shared code, or a change to stored data takes effect when the merged code runs, whatever the flag says. The merge is less risky only when the new code is self-contained and a test shows the old behavior unchanged with the flag off.
What it costs. Every flag doubles the cases to test, and a flag that stays forever becomes clutter, so give each one an owner and a date to remove it.
How do I get back?
With a rollback you have rehearsed, which means practiced. A rollback is a return to the last good state, like the old dish the kitchen keeps ready.
- For a flag, it is turning the flag off.
- For code, it is a revert: a new commit, or a new pull request, that undoes the merged one and keeps the history (15.2).1
Rehearse it before you need it. Ask the agent to do the revert on a branch, and check that the branch gives the old answer afterward.
Some things cannot be rolled back this way. A payment already sent stays sent, and a message already delivered stays delivered. That is why turning on a flag that sends money is its own high-tier decision (15.9).
Who watches it after the merge?
The person who merged it, or who directed the agent that wrote it. They are the first to fix it if it breaks. Review shares understanding, and it does not hand the responsibility to someone else.
At work. The weekend rule is on main with the flag off, and a test, "with the rule off, the answer is unchanged", checks the 8 invoices on every change. Ana rehearses a revert of the merge on a scratch branch. The weekend code disappears, every check still passes, and the answer is still 8 invoices. Dave Kowalski, the controller, will decide in April whether to turn the rule on. The person who turns it on owns the first Friday run with it.
Try it
In your practice folder from 15.1, the weekend rule is still on its own branch. You merge it on a practice branch with the flag off, and then rehearse the way back. Ten minutes.
-
Predict in your note: after the merge, how many invoices are due by Friday with the flag off, and with it on? And after the revert?
-
Send: "Make a new branch practice-merge from main. Merge weekend-rule into it, and make a merge commit: do not fast-forward. Then run the due list for 2027-03-05 two times: once as it is, and once with the setting PAY_WEEKEND_RULE set to on for that one run. Show me the last line of each."
Why "do not fast-forward"? Without those words, git only adds the two weekend commits to the branch and records no merge. With them, the merge is one commit, and step 3 can undo it in one move.
-
Send: "Now revert that merge with a new commit. Run the due list both ways again, and then the tests. Show me the last line of each, and how many tests passed."
-
Send: "Show me the last three commits on this branch, and then switch back to main." In your note, name one thing a revert could not undo at Brightline.
What you should see. After the merge, 8 invoices, total $19,229.53 with the flag off, and 10 invoices, total $33,109.53 with it on. After the revert, 8 invoices with the flag on or off, and all 35 tests pass, because the weekend code and its tests are gone. The history keeps both commits: the merge, and above it the revert. A revert cannot undo a payment already sent.
The operating rule: merge risky behavior behind a flag that is off, turn it on as a separate decision, and rehearse the way back before you need it.

Figure 15.16. From merge to everyone. Merged is not deployed, and deployed, which means running in production, is not turned on. Each stage is a separate decision, with a way back.
Other words you will meet
| Word | What it means |
|---|---|
| Merge queue | A line of approved pull requests. It tests each one on top of the latest main plus the changes ahead of it, so two changes that each pass alone cannot break main together2 |
| "You land it, you own it" | A team saying. To land a change means to merge it, and whoever merges it watches it and fixes it first |
Check yourself
Question 1 / 9
0 answered
Two pull requests each pass their checks against Monday's main. Merged together on Tuesday, main breaks. What would have caught it?
Sources
- Owner
- Panaversity