Native Stacked PRs in GitHub

At the moment, in order to do stacked PRs (i.e. a sequence of PRs that depend on each other), we rely on third party options such as Graphite, which is not ideal.

GitHub appear to be previewing a new stacked PR workflow that is native to the environment. See GitHub Stacked PRs | GitHub Stacked PRs . It’s a private preview situation, so repos have to request access and then sit on a waiting list to gain the functionality. Does anybody have any experience with them in another repository? If so, is it worth us requesting access for LLVM?

3 Likes

FWIW, we already requested access for LLVM.

9 Likes

Fair enough, thanks!

Worth noting that GitHub is slapping a UI here, without addressing the main limitation we face with stacked PRs today: they can’t be used from a fork (which is why we have to keep user branches in the main repo today).

It may still be a welcome improvement for StackedPR UI, and remove dependencies on tooling or manual bookkeeping, but just mentioning in case some may not have read the fine prints! :slight_smile:

4 Likes

Do you know if we will get an org-wide email or something once the LLVM organization is granted access?

I requested access for LLVM but I’m still waiting for response, I’ll let you all know if/when I hear back.

8 Likes

Stacked PRs has been enabled for all repositories under llvm. You can find documentation and getting started guides here: GitHub Stacked PRs | GitHub Stacked PRs. Regular pull requests will continue to work as they do today, so users who are not creating stacks should not see any changes. Please share any feedback or questions here: github/gh-stack · Discussions · GitHub.

16 Likes

I’m noticing that it doesn’t appear possible to bypass merge requirements for stacked PRs. Initially, I wasn’t sure if that was a configuration issue or an issue with Github’s implementation. I found Bypass merge requirements not working on stacked PRs · github/gh-stack · Discussion #186 · GitHub which suggests it may be the latter. Putting it here in case anyone else runs into this too.

This seems like a moment where it would be useful to have a frivolous test repository under llvm-project, containing nothing important, so that people could open test PR stacks in it and get used to the mechanics of the new tooling, without making a huge mess in the real LLVM repo if they get it wrong.

(If the stacked PR tool were not restricted-access, of course, anyone could make their own test repo and throw it away once they were done!)

3 Likes

Time to update LLVM GitHub User Guide — LLVM 24.0.0git documentation ? In particular:

While GitHub does not natively support stacked pull requests, there are several common alternatives.

is now stale.

I don’t have the contextual knowledge of how these work to do it myself.

Am I doing it wrong? I have two branches on my fork, I create a PR into main for the first branch, then create a PR in my fork for my second branch into my first branch, but there’s no UI for creating a stack as described at Stacked PRs in the GitHub UI | GitHub Stacked PRs . FAQ | GitHub Stacked PRs suggests it’s just not supported?

I believe you need to create user branches in the monorepo as using branches from forks currently is not supported.

1 Like

A warning to all:

The footer that gh stack automatically adds to the PR summary won’t be automatically trimmed when squashing and merging, so make sure you remove it manually, otherwise your merged commit message will have


---

<sub>Stack created with <a
href="https://github.com/github/gh-stack">GitHub Stacks CLI</a> • <a
href="https://gh.io/stacks-feedback">Give Feedback 💬</a></sub>

at the end. See [NFC][test][ELF] Improve ppc32-ifunc-nonpreemptible-(no)pic.s (#210611) · llvm/llvm-project@50ce5f7 · GitHub and [NFC][test][ELF] Check DSO's ifunc2 is in .iplt in aarch64-ifunc-bti.… · llvm/llvm-project@88d17fa · GitHub for my mistake that hopefully will prevent others from having their own permanently recorded in the Git history…

(Reported as Footer ends up in squashed commit messages · github/gh-stack · Discussion #300 · GitHub, in response to the feedback link being shoved in everyone’s faces…)

Note also, due to Editing commit messages on squash and merge · github/gh-stack · Discussion #285 · GitHub, there is no confirmation of the commit message to use, so you only find out once it’s too late.

3 Likes

I don’t have access to create a user branch in the monorepo as far as I can tell. users/iana/test said no. :slightly_frowning_face: I do have merge access, is it typical that I wouldn’t have branch creation access in users too?

If you have commit access, you should be able to create branches under the users/ namespace. This is likely on authentication problem on your end (repo-scoped token specific to your fork?).