Skip to content

Commit 50efe52

Browse files
randleeclaude
andcommitted
docs(sc-gh-stack): prohibit git reset --hard in workflow guidance
Hard rule 2 and the convert playbook's do-not list now name git reset --hard explicitly, with the sanctioned alternatives (rebase --abort/--continue, script-driven fast-forward). Scripts never used it; test fixtures keep it only to manufacture behind-remote states. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 78ad1f5 commit 50efe52

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

packages/sc-gh-stack/skills/managing-gh-stacks/SKILL.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,11 @@ installed — **do not reproduce the rebase chain or preflight checks by hand.**
7979
1. Never run bare `view`, `submit`, `init`, `add`, `checkout`, `switch`, or `modify` — they
8080
prompt or open a TUI and block forever. Use `view --json`, `submit --auto`, `init <b>...`,
8181
`add <b>`, `checkout <target>`, `up/down/top/bottom`. `modify` has no non-interactive form.
82-
2. Never `gh pr merge` a stacked PR; never `git push --force`; never merge layers into each
83-
other by hand. `gh stack` owns pushing (`push`, `submit`, `sync`) and merging (`merge --yes`).
82+
2. Never `gh pr merge` a stacked PR; never `git push --force`; never `git reset --hard` as
83+
part of a workflow (it discards commits and rerere state — recover with `git rebase
84+
--abort`, `git rebase --continue`, or a fast-forward instead); never merge layers into
85+
each other by hand. `gh stack` owns pushing (`push`, `submit`, `sync`) and merging
86+
(`merge --yes`).
8487
3. Never restructure with metadata. Rechain with `git rebase --onto`, then `unstack` + `init`
8588
(`references/troubleshooting.md`, "Restructuring a stack").
8689
4. A change belongs to the layer that owns the concern: check out that layer, commit, then

packages/sc-gh-stack/skills/managing-gh-stacks/references/playbook-convert.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44
Merging them one at a time costs n(n+1)/2 CI runs and forces every remaining branch to rebase
55
after each merge. As a stack they cost n CI runs and land atomically.
66

7-
**Do not:** force-push, merge branches into each other by hand, `gh pr merge`, use `gh stack add`
8-
(it only appends to a stack's top), or try to "fix" order with metadata. Ancestry first.
7+
**Do not:** force-push, `git reset --hard` (to abandon a conflicted rebase use
8+
`git rebase --abort`; to move a branch to its remote let the script fast-forward it), merge
9+
branches into each other by hand, `gh pr merge`, use `gh stack add` (it only appends to a
10+
stack's top), or try to "fix" order with metadata. Ancestry first.
911

1012
## Inputs
1113

0 commit comments

Comments
 (0)