Home / Companies / LogRocket / Blog / Post Details
Content Deep Dive

Using stacked pull requests in GitHub

Blog post from LogRocket

Post Details
Company
Date Published
Author
Simohamed Marhraoui
Word Count
1,337
Language
-
Hacker News Points
-
Summary

Code reviews can be challenging, especially with large pull requests (PRs), which require significant time and mental focus. Stacked pull requests offer a solution by allowing large changes to be split into smaller, more manageable units that are easier to review. These PRs are dependent or incremental and are created by branching feature branches off other feature branches, similar to organizing code with multiple commits. Stacked PRs are particularly useful for sharing code changes across multiple branches and facilitating collaboration between team members working on the same feature. For example, when migrating a codebase to TypeScript, stacked PRs allow different parts of the project to share configurations without prematurely committing to the main branch. Creating and merging stacked PRs involves checking out branches in sequence and ensuring the PRs are clearly labeled to avoid confusion. While merging, direct merging is preferred over squashing or rebasing to maintain Git history integrity. Stacked PRs can also enhance the Gitflow workflow by allowing selective feature branch releases.