Skip to content

Commit bb4dae8

Browse files
authored
Merge pull request #338 from WordPress/docs/stacked-pull-requests
docs: describe how to open and merge a stack
2 parents ce4f8dd + 2cb0ba0 commit bb4dae8

1 file changed

Lines changed: 24 additions & 1 deletion

File tree

.github/CONTRIBUTING.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,34 @@ Assigned issues left quiet for two weeks may be unassigned. Comment to pick one
4141

4242
## Pull requests
4343

44-
1. Branch off `main`.
44+
1. Branch off `main`, or off the parent branch if this is one of a stack.
4545
2. Title the pull request as a [Conventional Commit](https://www.conventionalcommits.org/). Pull requests are merged with a merge commit whose subject is the pull request title, so the title is what release-please reads. `lint-pr.yml` enforces this.
4646
3. All CI checks must pass before merge (PHPCS, PHPStan, PHPUnit across PHP 7.4 + 8.3 plus a multisite run, Playwright).
4747
4. Keep commits focused, one logical change per commit.
4848

49+
### Stacks
50+
51+
A change too large to review in one pass goes in as a stack: each pull request based on the previous one, so each diff is only what that step added. Split where the reviewer's question changes, not every N lines. Nothing beyond git and `gh` is needed.
52+
53+
```bash
54+
git checkout -b feature/thing-schema main
55+
# commit
56+
git checkout -b feature/thing-write
57+
```
58+
59+
Open each one against its parent, or its diff carries the parent's work too:
60+
61+
```bash
62+
gh pr create --base main --head feature/thing-schema
63+
gh pr create --base feature/thing-schema --head feature/thing-write
64+
```
65+
66+
Put the same numbered list of the whole stack at the top of every body, marking the current one, so a reviewer landing in the middle knows what it sits on.
67+
68+
When a lower pull request changes, rebase each branch above it in order and push with `--force-with-lease`, never plain `--force`.
69+
70+
Merge bottom-up, one at a time, each on its own green CI. GitHub retargets a child to `main` when its base is merged and deleted, so nothing needs re-pointing by hand.
71+
4972
## Getting credited
5073

5174
Props are tied to WordPress.org profiles, not GitHub accounts. Props-bot comments the running list on every pull request. Two things let it find you:

0 commit comments

Comments
 (0)