Skip to content

Commit 1d2d9a9

Browse files
adinauerclaude
andcommitted
docs: Add collection branch safety warnings to PR workflow
Add explicit warnings to pr.mdc and create-java-pr skill that the collection branch must never be manually merged or fast-forwarded. Updating it causes GitHub to auto-merge all stack PRs and delete their branches, destroying the entire stack. Co-Authored-By: Claude <noreply@anthropic.com>
1 parent d501a7e commit 1d2d9a9

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

.claude/skills/create-java-pr/SKILL.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ Derive the branch name from the changes being made. Use `feat/`, `fix/`, `ref/`,
3535

3636
**For stacked PRs:** For the first PR in a new stack, first create and push the collection branch (see `.cursor/rules/pr.mdc` § "Creating the Collection Branch"), then branch the PR off it. For subsequent PRs, branch off the previous stack branch. Use the naming conventions from `.cursor/rules/pr.mdc` § "Branch Naming".
3737

38+
**CRITICAL: Never merge, fast-forward, or push commits into the collection branch.** It stays at its initial position until the user merges stack PRs through GitHub. Updating it will auto-merge and destroy the entire PR stack.
39+
3840
## Step 2: Format Code and Regenerate API Files
3941

4042
```bash

.cursor/rules/pr.mdc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,8 @@ git push -u origin HEAD
185185
gh pr create --base main --draft --title "<type>(<scope>): <Topic>" --body "Collection PR for the <Topic> stack. Squash-merge this once all stack PRs are merged."
186186
```
187187

188+
**CRITICAL: Do NOT manually update the collection branch.** Never merge, fast-forward, or push stack branch commits into the collection branch. The collection branch stays at its initial position (the empty commit on `main`) until the user merges individual stack PRs into it one by one through GitHub. If you fast-forward the collection branch to include stack commits, GitHub will auto-merge and delete all stack PR branches, destroying the entire stack.
189+
188190
### Creating a New Stacked PR
189191

190192
1. Start from the tip of the previous stack branch (or the collection branch for the first PR).
@@ -237,12 +239,12 @@ Once all stack PRs are merged into the collection branch, the collection PR is *
237239

238240
### Syncing the Stack
239241

240-
When a base PR changes (e.g. after addressing review feedback on PR 1), merge the changes forward through the stack:
242+
When a base PR changes (e.g. after addressing review feedback on PR 1), merge the changes forward through the stack **between adjacent stack PR branches only**:
241243

242244
```bash
243245
# On the branch for PR 2
244246
git checkout feat/scope-attributes-logger
245-
git merge feat/scope-attributes
247+
git merge feat/scope-attributes-api
246248
git push
247249

248250
# On the branch for PR 3
@@ -251,4 +253,6 @@ git merge feat/scope-attributes-logger
251253
git push
252254
```
253255

256+
**Never merge into the collection branch.** Syncing only happens between stack PR branches. The collection branch is untouched until the user merges PRs through GitHub.
257+
254258
Prefer merge over rebase — it preserves commit history, doesn't invalidate existing review comments, and avoids the need for force-pushing. Only rebase if explicitly requested.

0 commit comments

Comments
 (0)