Rulesets that allow only squash merging is not honored, have to set repo wide? #184410
Replies: 9 comments 4 replies
Rulesets merge method restrictions only work when all merge types are enabled in repo settings. The repo-wide settings act as the master switch, rulesets can only restrict further from there. |
|
Rulesets don't enforce squash-only per branch. Repo-wide "Allow squash merging" wins. Sucks, but true. *Hack it*
No per-branch merge control. GitHub half-assed it. |
|
🕒 Discussion Activity Reminder 🕒 This Discussion has been labeled as dormant by an automated system for having no activity in the last 60 days. Please consider one the following actions: 1️⃣ Close as Out of Date: If the topic is no longer relevant, close the Discussion as 2️⃣ Provide More Information: Share additional details or context — or let the community know if you've found a solution on your own. 3️⃣ Mark a Reply as Answer: If your question has been answered by a reply, mark the most helpful reply as the solution. Note: This dormant notification will only apply to Discussions with the Thank you for helping bring this Discussion to a resolution! 💬 |
|
Rulesets currently do not override repository‑level merge method settings. Even if your ruleset specifies “Allowed merge methods: Squash”, GitHub will still follow the repo‑wide merge options unless those options are also restricted at the repository level. That’s why your protected branches still show all merge types until you disable them globally. To enforce merge rules on specific branches only, you must: Disable the unwanted merge methods in Repository Settings → Pull Requests Then use rulesets to further restrict behavior on selected branches At the moment, rulesets cannot independently enforce merge‑method restrictions unless the repo‑wide settings already match those restrictions. This is a limitation of how GitHub prioritizes merge settings. 😄 |
|
Hi! This behavior is expected based on how GitHub currently prioritizes merge settings. Repository-level merge settings act as the “source of truth”, and rulesets can only restrict options that are already enabled at the repo level. They cannot fully override or enforce a merge method independently. So even if your ruleset says “Squash only”, GitHub will still show other merge options if they are enabled in the repository settings. To make it work as closely as possible:
However, in practice, this feature can be inconsistent and may not strictly enforce squash-only behavior per branch. This is a known limitation and has been reported by multiple users. If strict control is required, the only reliable approach right now is to configure merge methods at the repository level, even though it affects all branches. Hope this clarifies things 👍 |
|
🕒 Discussion Activity Reminder 🕒 This Discussion has been labeled as dormant by an automated system for having no activity in the last 60 days. Please consider one the following actions: 1️⃣ Close as Out of Date: If the topic is no longer relevant, close the Discussion as 2️⃣ Provide More Information: Share additional details or context — or let the community know if you've found a solution on your own. 3️⃣ Mark a Reply as Answer: If your question has been answered by a reply, mark the most helpful reply as the solution. Note: This dormant notification will only apply to Discussions with the Thank you for helping bring this Discussion to a resolution! 💬 |
|
This is a known GitHub limitation. Rulesets cannot independently enforce merge methods — they can only restrict further from what's already allowed at the repository level. Go to Repository Settings → General → Pull Requests This should restrict squash-only on the targeted branches while keeping other branches unrestricted. The ruleset is enabled (not in draft mode) Note: Per-branch merge method enforcement via rulesets is not available on the Free plan — it requires Team or Enterprise. That may be the root cause here. |
|
🕒 Discussion Activity Reminder 🕒 This Discussion has been labeled as dormant by an automated system for having no activity in the last 60 days. Please consider one the following actions: 1️⃣ Close as Out of Date: If the topic is no longer relevant, close the Discussion as 2️⃣ Provide More Information: Share additional details or context — or let the community know if you've found a solution on your own. 3️⃣ Mark a Reply as Answer: If your question has been answered by a reply, mark the most helpful reply as the solution. Note: This dormant notification will only apply to Discussions with the Thank you for helping bring this Discussion to a resolution! 💬 |








Uh oh!
There was an error while loading. Please reload this page.
Select Topic Area
Question
Body
I have configured rulesets on my primary permanent branches to allow only squash merges, but when I merge PR's to these protected branches, any merge option can be used.
I configure branch rules as:
Require a pull request before mergingDismiss stale pull request approvals when new commits are pushedAllowed merge methods:SquashThis is not working.
I have to change my repo wide settings:
Pull Requests:Allow squash mergingAnd then the PR's honor the repo wide settings.
How do I get rulesets to enforce merge rules for specific branches only?
All reactions