Skip to content

Stacked PRs need to support non-linear history ("merge-mode") #553

Description

@samuelwenker

Assume I've got a PR stack with three branches.

Main <- API <- UI

There are two active PRs.
Main <- API
API <- UI

In parallel, I'm getting code review feedback on both PRs. My team members "Peer-API" and "Peer-UI" are experts in those areas and are doing the reviews.

I take a comment from "Peer-UI" and push a commit to the UI branch.
I take a comment from "Peer-API" and push a commit to the API branch.

The second commit forces a rebase of commits in the UI branch.

Now, my team member "Peer-UI" sees that a new iteration is published, so they want to look at what changed. They go to the files tab, click "All commits", and choose "Changes since your last review"...

...and it fails. The rebase destroyed the original commit they reviewed. Ther is no "last review" - the automatic rebase plus force push destroyed the commit history.

In this very simple example, "Peer-UI" can manually click the second commit to just see what changed in it. But as soon as you ramp up the total number of commits and PRs in the stack, it becomes a total mess. A reviewer can't even open commits they reviewed previously, let alone diff against them. Depending on what changes during the review, it may even be impossible to figure out which line of code any given PR review comment was talking about!

Forcing rebases and a linear history fundamentally prevents us from using stacked pull requests.

I propose that Stacked PRs need to support an entirely separate variant designed around using "git merge" (instead of "git rebase") with non-linear history - I call this "merge-mode".

When a stacked PR is created in "merge-mode":

  • Child branches use "git merge" to take updates from the parent, not "git rebase".
  • Linear history is neither required nor typical.
  • Never a rebase, never a force-push.

I absolutely love the concept of stacked PRs. If they supported a mode that maintains complete (non-linear) commit history, they'd be extremely valuable. As-is, they are completely unusable; loss of commit history is a fatal limitation.

Activity

  1. samuelwenker commented on Oct 8, 2026

    @samuelwenker
    Author

    Proposed enhancement to "merge-mode":

    Assuming "merge-mode" (described above) is implemented, here is a proposed enhancement.

    Allow a configuration (at org level, repo level, and/or individual PR level) with the following checkbox (default unchecked).

    "When a stacked PR in merge-mode takes an automatic git merge due to an ancestor PR in the stack being updated, do not reset approvals".

    In the simple example above, once "Peer-UI" approves the PR for the UI changes, they shouldn't have to re-approve just because I made internal implementation changes in the "API" layer. Currently, they must re-approve every time there's a new commit in API because approvals are automatically reset whenever a new commit goes into a branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions