Disable "Squash and merge" on some specific branches #10809
Replies: 421 comments 114 replies
-
+1. same exact use case. there are so many options in the "Branch protection rules" I was surprised this wasn't one of them (and also it seems like a good place to hang this feature) |
Beta Was this translation helpful? Give feedback.
-
+1 We want to enforce We have resorted to using memes to try to get everyone to remember to apply the right merge type for the right branch:
|
Beta Was this translation helpful? Give feedback.
-
+1 This seems like a pretty normal use case. |
Beta Was this translation helpful? Give feedback.
-
+1 I really would like to set merging strategies per branch – same way as it is possible now for the whole repository. For benchmark: Azure Repositories does it really well. Other things are far worse, but this is where they're superior in my opinion. |
Beta Was this translation helpful? Give feedback.
-
+1 Our team would like to configure merge strategy for each branch separately as well |
Beta Was this translation helpful? Give feedback.
-
Yes, this keeps biting us as well. GitHub... please hear our cries! |
Beta Was this translation helpful? Give feedback.
-
Branch protection rules appears to be the right place to define this. Github, please reach out if you are looking for beta testers for this feature request. ;-) |
Beta Was this translation helpful? Give feedback.
-
Thanks a lot those who showed interests in this feature request! |
Beta Was this translation helpful? Give feedback.
-
This would be a great feature. The number of times people on our team accidentally squash merge to master, then I'm forced to resolve conflicts on develop...urgh! |
Beta Was this translation helpful? Give feedback.
-
It persists the button as whatever last one you used, which makes this really easy to flub. Then the poor sucker who has to do the next merge into the deploy branch has a mess to unravel. |
Beta Was this translation helpful? Give feedback.
-
Yeah, this feature would be great. |
Beta Was this translation helpful? Give feedback.
-
yes please allow specify merge strategy per branch protection rule... |
Beta Was this translation helpful? Give feedback.
-
+1 exact same use case. Surprising that it hasn't been considered for so long. |
Beta Was this translation helpful? Give feedback.
-
+1. We've been promoting branches associated with environments so dev->stg->prod and it would be great to enforce squash merge into dev and disable squash merge for stg and prod. |
Beta Was this translation helpful? Give feedback.
-
+1 need this |
Beta Was this translation helpful? Give feedback.
-
+1 we definitely have the same use case |
Beta Was this translation helpful? Give feedback.
-
In the interest of getting an official response from GitHub, I am tagging the leadership team: @ashtom, @mariorod I imagine they lose customers every day to GitLab because of this very issue. What is the issue?Users need to restrict what kinds of PR merge are allowed depending on the target branch, not as a global repo setting like it currently is. How can it be fixed?Simply add a branch protection rule setting that allows restricting the PR merge type. User Story 1Millions of people use GitHub branches to represent deployment environments. They want the following:
This ensures that each commit in each environment has the same hash, while also preventing bedlam in the dev branch from people who don't understand what squashing is. User Story 2Many people use "staging" branches to test multiple features/changes before mering into They want the following:
This ensures that PRs into |
Beta Was this translation helpful? Give feedback.
-
Thanks for all the feedback here, I really appreciate it. We’ve been discussing this topic for a while and how to address this with repository rules as the way to limit which merge methods are available per branch. We’ll be back soon to share a link to a new public roadmap item for this with details around timing and the plans to address this gap. |
Beta Was this translation helpful? Give feedback.
-
I know it's better to have this feature in the backend, but for anyone okay with a frontend solution to avoid mistakes when merging PRs, I've built an extension. I use squash for all branches except when merging into master, but sometimes I make mistakes in the process. The extension lets you customize settings for repos, source/destination branches, and merge options. Feel free to check it out, and I'd appreciate any feedback or suggestions! https://chromewebstore.google.com/detail/github-pr-merge-strategy/nhejampjhfhnalboieehcfhehmmfljhg |
Beta Was this translation helpful? Give feedback.
-
it's already resolved https://github.com/orgs/community/discussions/146284 |
Beta Was this translation helpful? Give feedback.
-
Hi,
I'm now building a deploy workflow for a monorepo, and trying to set up a CI workflow triggered by a push to a special branch (like
production
) for deployment. We currently merge regular PRs to the main branch using "Squash and merge" by enabling "Require linear history" option, and merging "deploy" PRs to the production branch with "Create a merge commit" in order to avoid unexpected divergent.It works, but not perfect because "Squash and merge" button is present when merging a PR to the production branch.
As far as I searched, I couldn't find a good way to enforce developers to use "Create a merge commit".
Is there a good way to achieve that?
So far, I could find a stackoverflow saying it's not possible.
Thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions