Problem
When a parent branch in a stack is squash-merged into main, stck sync cannot rebase the remaining stack. Each original commit from the squash-merged branch conflicts with what's already in main, because git doesn't recognize them as already-upstream.
Steps to reproduce
- Have a stack:
main <- A <- B <- C
- Branch A has commits
a1, a2, a3
- Squash-merge A into main (creates single commit
a_squashed)
- Retarget B to
main
- Run
stck sync
- Result: conflict on every commit from A (
a1, a2, a3) because git doesn't know they're already in main
Workaround
We had to manually identify the fork point (last commit unique to the parent branch) and use git rebase --onto per branch:
git rebase --onto origin/main <old-parent-tip> <branch>
This had to be done for each branch in the stack, finding the correct fork point each time.
Suggestion
stck sync could detect squash-merged parents by comparing the tree/diff rather than commit hashes. Alternatively, it could use git rebase --onto with the merge-base of the old parent, skipping commits that are already represented in the target.
GitHub's "Squash and merge" is the most common merge strategy for PRs, so this is likely the primary scenario for stacked PR workflows.
Problem
When a parent branch in a stack is squash-merged into main,
stck synccannot rebase the remaining stack. Each original commit from the squash-merged branch conflicts with what's already in main, because git doesn't recognize them as already-upstream.Steps to reproduce
main <- A <- B <- Ca1, a2, a3a_squashed)mainstck synca1, a2, a3) because git doesn't know they're already in mainWorkaround
We had to manually identify the fork point (last commit unique to the parent branch) and use
git rebase --ontoper branch:This had to be done for each branch in the stack, finding the correct fork point each time.
Suggestion
stck synccould detect squash-merged parents by comparing the tree/diff rather than commit hashes. Alternatively, it could usegit rebase --ontowith the merge-base of the old parent, skipping commits that are already represented in the target.GitHub's "Squash and merge" is the most common merge strategy for PRs, so this is likely the primary scenario for stacked PR workflows.