TL;DR All unreviewed changes should be merged to the main branch via a GitHub Pull Request (PR). If you create PRs for all your changes and submit them (with or without reviewers approval) using the GitHub UI, this proposal does not affect you.
Introduction
The LLVM project’s current contribution model is a hybrid of direct commits to the main branch and PRs. This model is the result of our migrations from SVN to Git and from Phabricator to GitHub. The LLVM Developer Policy still reflects legacy “obvious commit” and "trust but verify” practices, which are at odds with the tooling and scale of the project today.
This RFC proposes that we complete our transition to a modern development workflow by requiring all changes to the llvm-project repository to go through the GitHub Pull Request process and revoking direct commit access to the main branch.
Proposal
This RFC proposes a change to the LLVM development process to standardize on a Pull Request-centric workflow. The goal is to unify the contribution mechanism, with stricter enforcement of checks and approvals to be considered in future proposals.
- The
mainbranch of the llvm-project repository will be configured with branch protection rules to disallow direct pushes. - All code contributions, from all developers, must be submitted via a GitHub PR. This creates a single, auditable[1] path for all changes entering the repository.
- Direct commit access to
mainwill be revoked for all individual developers. Merging will be handled exclusively through the GitHub PR interface.
Non-proposal
This RFC explicitly does not propose making premerge checks mandatory, nor does it propose requiring reviewer approval[2].
Acceptance of this RFC does allow us to consider workflow changes like these, and they’re certainly worth discussing as a follow-up. That said, the intent of this proposal is to gather feedback on a process change that’s useful in its own right.
Rationale
Adopting a universal PR model, even without immediate enforcement of CI and reviews, provides foundational benefits for the project.
- Unlocking New Workflows: There are process improvements that would be unlocked by this change such as the ability to revert commits and to merge PRs to the release branch directly from the GitHub UI. The PR also provides a consistent place for post-commit review and allows the use of labels to track and coordinate post-commit reviews.
- Standardizing the Contributor Experience: This change lowers the barrier to entry for new contributors by standardizing on the “fork-and-PR” model. If contributors in a specific area use direct commits, it is difficult for new contributors to subscribe to changes or share feedback, which would be improved by having a PR for each change.
- A Foundation for Mainline Stability: While not strictly enforced, requiring PRs provides a clear venue for running pre-merge tests and encourages a “review-then-merge” mindset over the current “commit-then-revert” reality. This makes it easier to trace breakages back to a specific PR that includes any discussion and the evolution of the patch which is helpful in understanding the intent of the change.
- Enabling Future Process Improvements: This proposal is a prerequisite for any future improvements to our development process. We cannot programmatically enforce quality gates like mandatory reviews or CI until we first require that all changes pass through a PR. This move unlocks the ability to incrementally introduce more robust automation and governance in the future.
- Improving Security Posture: The current model grants direct write access to the
mainbranch to hundreds of developers, creating an unnecessarily large attack surface. Revoking direct commit access shrinks this surface and enforces the principle of least privilege.
Implementation
We are aware of concerns around the impact on developer velocity, but we believe the benefits outweigh the costs and a small overhead is a worthwhile trade-off. The primary change is the mechanical process of creating a PR versus a direct push.
While most contributors already use GitHub PRs and thus should be unaffected by this change, there are still a number of contributors relying on direct commits and we want to give them sufficient time to adjust to the new workflow.
Our proposal is to enable the “Require a pull request before merging” ruleset for the llvm-project repository upon acceptance of this RFC, but also give everyone the ability to bypass this rule for a trial period. This change would not prevent any existing workflows, you would still be able to directly commit to main, but you would see the following message every time you do so:
Bypassed rule violations for refs/heads/main:
- Changes must be made through a pull request.
This is similar to the “Require status checks to pass” ruleset we recently enabled as a prerequisite for the “auto-merge” feature.
We hope this change would encourage everyone to use GitHub PRs and to bring up any friction points so we can look into streamlining the workflow such as improving llvm/utils/git scripts to automate the creation of PRs for trivial changes.
We propose to remove the bypass option at the end of October. This coincides with LLVM Developers’ Meeting and we plan to host a round table to collect more feedback from the community and discuss potential future improvements.
@petrhosek on behalf of the @infra-area-team.
The Git commit log itself is not auditable since the Git commit author and committer can be changed. GitHub Activity view lets you see who pushed a change regardless of the Git metadata but it is not regularly reviewed. ↩︎
This is already the case today, while the reviewer approval on PR is strongly encouraged, it is not required; authors are also encouraged to use skip-precommit-approval label if they do not seek approval. ↩︎
