|
| 1 | +# Release Branch Pattern |
| 2 | + |
| 3 | +Use a release branch to concentrate several related feature changes into one release, when the changes are independent of each other but should ship, close their issues, and generate release notes together. |
| 4 | + |
| 5 | +This differs from [Module Bootstrap](module-bootstrap.md), which exists only to get a brand-new module's load-bearing core to its first release, and from a [stacked pull request](https://msxorg.github.io/docs/Ways-of-Working/Branching-and-Merging/#stacked-pull-requests), where each layer depends on the one before it. The release branch pattern applies to any module that already has a release, for a batch of independent features destined for the same version bump. |
| 6 | + |
| 7 | +## Pattern |
| 8 | + |
| 9 | +1. Cut one release branch from `main`, named for the release, e.g. `release-v1`. |
| 10 | +2. Open the **release pull request** immediately: release branch → `main`, as a **draft**. This PR stays open for the lifetime of the release and accumulates the `Closes #N` references for every issue the release resolves. |
| 11 | +3. Cut each feature branch from the release branch, not from `main`. |
| 12 | +4. Open each **feature pull request** targeting the release branch, not `main`. Feature PRs can land in parallel and in any order relative to each other, unless one feature explicitly depends on another (in which case stack those two normally). |
| 13 | +5. Merge feature PRs into the release branch as they become ready. |
| 14 | +6. Once every planned feature PR has merged into the release branch, un-draft the release PR and merge it into `main`. This merge becomes the release. |
| 15 | + |
| 16 | +```mermaid |
| 17 | +gitGraph |
| 18 | + commit id: "main" |
| 19 | + branch release-v1 |
| 20 | + checkout release-v1 |
| 21 | + branch feature-a |
| 22 | + branch feature-b |
| 23 | + checkout feature-a |
| 24 | + commit id: "PR: feature A" |
| 25 | + checkout feature-b |
| 26 | + commit id: "PR: feature B" |
| 27 | + checkout release-v1 |
| 28 | + merge feature-a |
| 29 | + merge feature-b |
| 30 | + checkout main |
| 31 | + merge release-v1 id: "release PR" |
| 32 | +``` |
| 33 | + |
| 34 | +## Release pull request body |
| 35 | + |
| 36 | +The release PR is the single place that: |
| 37 | + |
| 38 | +- Lists `Closes #N` for every issue resolved by any feature PR merged into the release branch. |
| 39 | +- Carries the combined release notes, written per [MSXOrg PR Format](https://msxorg.github.io/docs/Ways-of-Working/PR-Format.md), once every feature has landed. |
| 40 | + |
| 41 | +Feature PRs still follow PR Format for their own description, but do not need to duplicate `Closes #N` — the release PR is the one that closes issues when it merges to `main`. |
| 42 | + |
| 43 | +## Merge order |
| 44 | + |
| 45 | +- Merge feature PRs in dependency order. Independent feature PRs have no required order between them. |
| 46 | +- The release PR always merges last, after every feature PR it depends on has landed in the release branch. |
| 47 | +- Keep the release PR in draft for as long as feature PRs are still expected. Un-draft it only once the release branch is feature-complete and passing checks. |
| 48 | + |
| 49 | +## When to use this |
| 50 | + |
| 51 | +- The module already has a stable release, and several independent features are queued for the next version. |
| 52 | +- Skip this pattern for a single isolated change — use an ordinary topic branch targeting `main` directly. |
| 53 | +- Skip this pattern for a brand-new module with no release yet — use [Module Bootstrap](module-bootstrap.md) instead. |
| 54 | +- Use a [stacked pull request](https://msxorg.github.io/docs/Ways-of-Working/Branching-and-Merging/#stacked-pull-requests) instead when changes genuinely depend on each other in sequence, rather than being independent features batched into one release. |
| 55 | + |
| 56 | +For the general branching and merge model, see [MSX Branching and Merging](https://msxorg.github.io/docs/Ways-of-Working/Branching-and-Merging/). |
0 commit comments