Feature request: preserve PR approvals when a stacked PR’s diff is byte-identical after restack #205143
Replies: 2 comments
|
💬 Your Product Feedback Has Been Submitted 🎉 Thank you for taking the time to share your insights with us! Your feedback is invaluable as we build a better GitHub experience for all our users. Here's what you can expect moving forward ⏩
Where to look to see what's shipping 👀
What you can do in the meantime 💻
As a member of the GitHub community, your participation is essential. While we can't promise that every suggestion will be implemented, we want to emphasize that your feedback is instrumental in guiding our decisions and priorities. Thank you once again for your contribution to making GitHub even better! We're grateful for your ongoing support and collaboration in shaping the future of our platform. ⭐ |
|
FYI: I really like the |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
🏷️ Discussion Type
Product Feedback
💬 Feature/Topic Area
Other
Body
Today, when working with stacked pull requests (for example via the
gh stackCLI extension), any restack or rebase that changes the head SHA of a PR will cause existing approvals to be dismissed if branch protection is configured to “Dismiss stale pull request approvals when new commits are pushed.”This is correct and desirable when the underlying changes actually differ, but it can be painful in stacked workflows where an upper PR’s effective diff against the base branch hasn’t changed at all; only its ancestry and commit IDs changed because a lower branch was edited and the stack was restacked.
Request
Introduce an optional mechanism for preserving approvals on a pull request when a new head commit is pushed and the resulting patch is byte‑identical to the previously‑approved state. Concretely:
When a new commit becomes the PR head, compare the diff against the base branch to the previously approved diff.
If the patch is identical (e.g., via a stable patch‑ID / diff‑hash comparison), allow branch protection to treat the approval as still valid, even though the SHA changed.
This could be:
A new repository/branch‑protection setting (for example: “Preserve approvals when content is unchanged across rebases”), or
Behavior that applies specifically to stacks and/or to “restack” operations initiated by
gh stack.Motivation
In stacked workflows:
It’s common to update a lower‑level PR, restack with
gh stack syncor gh stack rebase, and thereby rewrite the SHAs of upper PRs.Those upper PRs often end up with exactly the same file‑level changes they had before, relative to the trunk/main branch.
However, any approval on those upper PRs is invalidated because their head SHAs changed, even though the reviewer has already approved the exact same content.
For teams with stricter branch‑protection and compliance requirements, this creates a tension:
We want to keep “dismiss stale approvals on new commits” enabled for real content changes.
But we also want stacked‑PR tooling to be first‑class, without forcing reviewers to repeatedly re‑approve byte‑identical changes after every restack.
Desired behavior (high level)
If the new PR head results in different content (different patch vs base), keep current behavior: dismiss approvals.
If the new PR head results in identical content (same patch vs base), optionally allow the system to:
Keep existing approvals as valid, or
Mark them as “carried forward across rebase” in the UI, while still satisfying branch protections.
This would make stacked PRs much more ergonomic in security‑sensitive setups, without weakening the guarantees that approvals reflect the actual code that will be merged.
All reactions