File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -175,6 +175,30 @@ uv run pytest # 124 tests, ~2s
175175uv run ruff check . # lint
176176```
177177
178+ ### Stacked pull requests
179+
180+ If PR B was opened on top of PR A's branch and A has since merged to
181+ main, B will show conflicts against main even though your own commits
182+ are clean. The conflicts are A's commits, now reachable from main via
183+ the merge, replaying against themselves.
184+
185+ Fix it by replaying only your commits onto main with
186+ ` git rebase --onto main <old-base-sha> <branch> ` . ` <old-base-sha> ` is
187+ the tip of A's branch at the moment you forked B — find it with
188+ ` git merge-base <branch> <A-branch> ` while A's branch still exists
189+ locally, or read it from the PR's "compare" base on github.com before
190+ the branch is deleted.
191+
192+ ``` bash
193+ # B = feature/b, was stacked on feature/a (now merged + deleted)
194+ git fetch origin
195+ old_base=$( git merge-base feature/b origin/main~1) # or paste the SHA
196+ git rebase --onto origin/main " $old_base " feature/b
197+ ```
198+
199+ Then force-push with lease — never plain ` --force ` :
200+ ` git push --force-with-lease ` .
201+
178202## Architecture
179203
180204```
You can’t perform that action at this time.
0 commit comments