Recently while I was working on some continuous-integration (CI) test suites for the WordPress Block Editor (Gutenberg) I had to wrestle with some of

What is a GitHub Pull Request merge branch?

submited by
Style Pass
2024-11-28 14:00:03

Recently while I was working on some continuous-integration (CI) test suites for the WordPress Block Editor (Gutenberg) I had to wrestle with some of the details of what happens behind the scenes in a Pull Request (PR) on GitHub and thought I’d share what I learned here in this post. Pull Requests involve some “magic” I have taken for granted for a long time, but there are some interesting details behind the curtain.

In this post we’re going to explore the hidden “merge branch” that tracks a PR’s development and see how GitHub uses that merge branch to provide diff views and previews of how the PR will impact the project once merged. Read on to dive in – this is a rather lengthy post because we build up a repo step by step to examine different scenarios that are possible in different PR situations.

You may have already known this, but PRs are a separate concept than a branch. For one, branches are transient while PRs leave a trace of their activity. Still, a PR mostly refers to a single branch during the time it is developed, and it can only point to one branch. A branch can be reused later on after it’s merged and deleted, but PRs cannot be deleted.

Leave a Comment