GitHub has unveiled Stacked PRs, a new feature aimed at making large pull requests easier to review, manage, and move through the pipeline faster.Stacked PRs, now in private preview, enable a pull request to be based on a previous pull request to form a stack. Each pull request in the stack can be reviewed and merged independently, provided that all the pull requests below it in the stack are merged first. It is also possible to merge the whole stack together.

There are several benefits to Stacked PRs, the most obvious being that they encourage smaller pull requests, which are therefore easier to review. "Each branch in a stack should represent a discrete, logical unit of work that can be reviewed independently," the docs explain.This is normally hard to achieve because developers typically want to continue working on code, even where the new code depends on earlier code that is not yet merged with the main branch. Waiting for each small piece to be reviewed and merged would cause too much delay, so instead they continue working in a separate branch until a feature is complete. The consequence is a large pull request with code changes in many files, which are hard to review.

Managing stacked PRs in GitHub