ManualLanding
How the merge train works
Two branches can each pass CI and still break the build when they meet on main. Which commit should you test?
When you ask to land a change on main, you’re asking Berrit to put the code on that target branch. There’s a queue for each target, called its merge train, so changes that are ready can land in order.
Why test a change again?
Section titled “Why test a change again?”Suppose you and I both start from the same commit on main. I rename a function from parseDuration to readDuration and update all its callers. Meanwhile, you add a --timeout flag. On your branch, the function is still called parseDuration, so that’s the name you use.
Both branches compile. Git can even merge them cleanly if we edited different lines. Try to build the two changes together, though, and your new flag calls a function that no longer exists.
What the train tests
Section titled “What the train tests”The commit you send for review is your revision. To see what would actually land, Berrit builds another commit with your work on top of the code ahead of it. That commit is the candidate.
Once we’ve both had our changes approved, we each ask Berrit to land them. In this repository we require a build on the train. Here’s what gets built if my rename reaches the queue first.
| Change in the queue | What goes into its candidate |
|---|---|
| My rename | The latest commit on main (the tip) plus the rename. |
| Your flag | My candidate plus your flag. This is what we’d have on main after both changes land. |
A build of the second candidate tells us whether both changes work together. If it passes and the tip hasn’t moved, Berrit can fast-forward main to the commit it just tested. My rename lands as an ancestor of that commit, even if CI never tested it separately. If someone moves the target branch in the meantime, the train builds against the new tip. You can leave that to Berrit unless it reports a conflict for you to resolve.
We already know why the build in our example fails. The train can narrow it down by testing my rename on its own. If that passes, the rename can land. Your change comes out of the queue but stays open. You can update the call to readDuration, send a new revision and ask to land again.
Where to see the result
Section titled “Where to see the result”Open Train for your target branch. Covers tells you which changes a run includes, and Candidate shows the commit it’s testing. To read the CI output, open a change number and choose Checks → Details beside the reported result. To confirm your change made it onto the branch, look for Landed on and the commit in the change’s Land panel.
A candidate can still be in the queue after its tests pass. If your repository has a landing step, Berrit runs it before moving the branch. If the Git host refuses that move, the train shows the reason. Find out what’s holding up a landing.
A newly connected repository has no external checks configured. If you want the train to wait for a build like the one in this example, require a check at the train stage.