Skip to content

[RFE] Standardize Pull Request, Merging workflow and branch protection rules #1714

@John15321

Description

@John15321

In the Flatcar organization, many repositories still lack branch-protection rules, and Pull-Request workflows vary widely from repo to repo. Below is a unified configuration proposal that can be applied to most repositories (some may require special settings).


1. Default branch

  • Set the default branch to main (or master).
    Most modern tools default to main, so choosing main simplifies integrations.

Default branch setting


2. Pull-Request settings

Pull-Request merge settings

  • Allow squash merging only
    Disallow “Merge commits” and “Rebase merging.” Squash merging produces a single commit per PR on the default branch, yielding a clean, linear history. The commit message defaults to the PR title + description, and the squash commit links back to the PR for traceability.
  • “Suggest updating branch”
    Encourages contributors to rebase their branch onto the latest default-branch changes. (You can later require branches to be up to date.)
  • Enable auto-merge once all requirements are met (approvals, CI).
  • Automatically delete head branches after merge to keep the branch list tidy.

3. Branch ruleset for the default branch

Create a ruleset targeting your default branch.

Branch ruleset overview


4. Bypass permissions

Maintainer-level teams should be granted “bypass” privileges so they can override rules when necessary.

Bypass list


5. Target branches

Set the rule’s target to your default branch (e.g. main).

Target branch setting


6. Individual rules

  1. Restrict deletions — prevent accidental branch deletion (default ON).

  2. Require linear history — forces contributors to rebase before merging.

    Require linear history

  3. Require review from Code Owners

  4. Require approval of the most recent reviewable push — guarantees the final approved commit is what gets merged.

  5. Require conversation resolution before merging — ensures all review comments are addressed.

  6. Allowed merge methods: Squash

    Allowed merge methods

  7. Require status checks to pass — CI must succeed before merge.

  8. Require branches to be up to date before merging — enforces rebasing onto the latest default branch.

    Status checks & up-to-date requirement

  9. Block force pushes — (optional; default ON; open for discussion).

    Block force pushes

  10. Require code-scanning results — integrate your chosen code-scanning tool on every repo.

    Require code scanning

Note: These settings serve as guidelines—or “rails”—to keep our workflow consistent and maintain a clean history. Maintainers retain the ability to bypass or adjust any rule when exceptional circumstances arise.

Metadata

Metadata

Assignees

Type

Projects

Status

⚒️ In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions