Merging
Merging is how finished work reaches your main code. Crank merges in two steps:
- Job into topic. When a job is finished and its checks pass, its work is merged into its topic's branch. The job is now Built.
- Topic into base. When the topic is ready and its merge rule allows, the whole topic is merged into its base branch (usually
main). Every job in that merge is now Merged.
When a topic is ready to merge
A topic is ready when nothing in it is Building or Needs operator, and at least one of its jobs is Built.
- Paused, scheduled, Queued and Waiting jobs don't hold the merge back. They join a later merge.
- Only the jobs that were merged are marked Merged. The topic shows as "partly merged" while it still has open jobs.
- After a merge, the topic carries on. Its next job starts fresh from the merged code.
- While a topic is merging, no new job starts in it, so nothing lands mid-merge.
- Why it's safe: each job is built on its own branch and only reaches the topic branch once it's finished and its checks pass. A job that hasn't started, or stopped part way, has its work only on its own branch. So the topic branch only ever holds finished work, and only finished work reaches
main. - Why the rule changed: before, one paused job held back everything already built in its topic.
Source: CB-72.
Tested against main, then a quick merge
- When a topic is ready, its own runner does the final step: brings in the latest of its base branch, runs the full checks, fixes anything that fails, and records which version of the base it was tested against. The topic shows "Testing against main".
- This step is a run of the topic's runner, so it obeys the topic's start window and the usage threshold like any job. Why: it uses your computer and your Claude plan, so it should fit your schedule.
- When the merge is due, if the base hasn't changed since that test, the merge runner merges at once, with no more tests. If the base has moved, the topic's runner tests again first.
- Keep up to date while waiting (per topic, off by default): when on, the topic re-tests each time its base changes while it waits. Why off by default: it uses your computer's CPU each time
mainchanges. When off, it's tested again only when the merge is due.
Source: CB-73.
When a merge fails
- The jobs stay Built. The topic gets a note, for example "merge blocked, fix job CB-29".
- Crank adds a fix job to the topic ("Fix at the merge to main: …"), which finds the cause and makes the smallest fix. It's a normal job. The next merge waits until it's Built.
- The note goes when the merge succeeds.
Source: CB-31, CB-72.
Base branches other than main
Some work stays on its own long-lived branch for a while, for example version-2.
- Each topic has a base branch,
mainby default. The topic is started from it, tested against it, and merged back into it. In settings: "This topic is branched from, tested against and merged back into this branch." - A new base branch is made from
mainonce, the first time a topic uses it. After that,mainis never merged into it automatically. Why: a fix onmainshould be done properly in the feature branch when it's wanted, not pulled in by surprise. - A topic's base can't be changed once its branch holds built work.
- All the merge rules above apply per base. A job is Merged when its topic reaches the topic's own base, shown as "Merged into version-2" when that isn't
main. - Merging
version-2intomainisn't automatic. For now, do it as a job in a topic whose base ismain, or by hand.
Source: CB-75, CB-76, CB-78.
Merge lanes
- There's one merge lane per base branch, so a merge into
version-2never holds up a merge intomain. Each lane merges one topic at a time. - The lane for
mainstarts at once. - For each other base, you choose: "Starts immediately", or "Uses the runner pool" (waits for a free runner slot and counts toward maximum runners). The pool is the default. Why: it's your computer; extra lanes shouldn't add load unless you say so.
- The merge runner card shows each busy lane, for example "merging api into version-2" or "waiting for a runner slot".
Source: CB-75, CB-76.
Merge history
A Merge history tab, after The list, shows each merge: the topic, its branch, start time, run time and any problems.
Source: CB-18.