Repository navigation
Commit 91b311f
committed
docs: say why a rebase drops a merged parent's commits, and what that ref is
Two corrections to the stacked-PR guidance, both learned from landing the
generator-payload-alignment stack.
FIRST: `git rebase -S origin/main` after a parent merges was already the
documented step, with nothing explaining why it works. GitHub reports the
child as CONFLICTING the moment its parent merges — the parent's commits are
on main under new SHAs while the child still carries the originals, so a
three-way merge sees two versions of the same work. The rebase does not,
because it drops commits whose patch-id already appears upstream. Measured: a
child 5 commits above main, two of them stale copies, rebased to 3 cleanly.
Without that sentence, the badge reads as damage and invites a hand repair of
something that is already fine. It also now names the opposite case, which
needs the opposite tool: a parent rewritten but NOT merged has no upstream
patch-id to match, so a plain rebase replays superseded commits on top of
their replacements, and the fix is `--onto` from where the child forked.
SECOND: the recovery section said `refs/pull/<n>/head` "points at the
pre-merge tip". True only when GitHub did not rebase the branch before
merging it. Measured on #214: that ref was `e040449`, whose parents include a
PR merged after #214 was opened, while the tip actually pushed was `4851e8d`
with the same content under a different SHA.
The distinction matters because the two uses differ. Restoring a deleted
branch only needs the content, so either SHA does. Rebasing a child needs the
specific commits that child contains, and the rebased copy is not those — it
would replay the stale commits instead of dropping them.1 parent fc01950 commit 91b311f
1 file changed
Lines changed: 30 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
193 | 193 | | |
194 | 194 | | |
195 | 195 | | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
196 | 216 | | |
197 | 217 | | |
198 | 218 | | |
| |||
213 | 233 | | |
214 | 234 | | |
215 | 235 | | |
216 | | - | |
| 236 | + | |
217 | 237 | | |
218 | 238 | | |
219 | 239 | | |
220 | 240 | | |
221 | 241 | | |
222 | 242 | | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
223 | 252 | | |
224 | 253 | | |
225 | 254 | | |
| |||
0 commit comments