Default merge strategy (per org, repo or branch) #20583
Replies: 135 comments 26 replies
-
Make totally sense, +1 for such improvement |
Beta Was this translation helpful? Give feedback.
-
It would also be interesting to have the option for users to define a default strategy. For example, if I work in multiple organisations and Org A defines "Fast Forward" as a default and Org B defines no default, if I set my default to "Squash" merging a PR in Org A would use "Fast Forward" as the strategy whereas merging a PR in Org B would use "Squash". |
Beta Was this translation helpful? Give feedback.
-
A default strategy per branch is a good improvement, but I'd rather completely disable certain strategies with certain branches. |
Beta Was this translation helpful? Give feedback.
-
It's pretty annoying to not be able to have different merge strategies per branch. We have repos where we use a strategy of merging PRs into a develop branch, and to release we merge develop into main. We want to enforce squash merge from PRs into develop, but never squash merge from develop to main because then git gets very confused about what has already been merged. |
Beta Was this translation helpful? Give feedback.
-
+1 I need to define allowed and default merge method individually for some named branches. |
Beta Was this translation helpful? Give feedback.
-
+1 |
Beta Was this translation helpful? Give feedback.
-
+1 - Very useful for open-source projects with multiple repos |
Beta Was this translation helpful? Give feedback.
-
+1 - very useful for project with env specific branches |
Beta Was this translation helpful? Give feedback.
-
+1 This would be very helpful to companies using different merging for lower environments than those used in the upper envs. |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
+1. This is absolutely necessary. If I have master, release and develop. Then I only want to allow squash merge into develop (I usually like 1 commit per change rather than 50 or more, which gets messy imo). Rest needs to be regular commit. Otherwise the github compare mechanisms starting thinking there are missing commits and it does not work well. |
Beta Was this translation helpful? Give feedback.
-
+1 |
Beta Was this translation helpful? Give feedback.
-
+1 |
Beta Was this translation helpful? Give feedback.
-
other relevant issue that is very similar to this one 👉 https://github.com/orgs/community/discussions/10809 |
Beta Was this translation helpful? Give feedback.
-
+1 I think it would be pretty simple to implement since UI already has |
Beta Was this translation helpful? Give feedback.
-
Please papa microsoft, before Lina Khan busts your monopoly |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
+1 |
Beta Was this translation helpful? Give feedback.
-
+1 |
Beta Was this translation helpful? Give feedback.
-
+1 |
Beta Was this translation helpful? Give feedback.
-
+1 |
Beta Was this translation helpful? Give feedback.
-
TL;DR - Were working on it. We are going to address this with repository rules as the way to limit which merge methods are available per branch. More details here in the other discussion post https://github.com/orgs/community/discussions/10809#discussioncomment-10329765 |
Beta Was this translation helpful? Give feedback.
-
I'm not 100% sure this is the exact issue for this feedback (since this seems to be mainly about "rebase" vs. "squash"), but it's at least similar. One pain point I have is that my merge strategy ( This is a pain because resolving conflicts wipes out reviewer Approvals, whereas conflict-free merges do not. That means that on local, I can easily This is especially painful if I go on a productive streak and push 5-6 PRs, each of which touch the NEWS. It generates a tedious dance where reviewers have to continuously re-Approve PRs (n choose 2 --> a quadratically increasing number of approvals). |
Beta Was this translation helpful? Give feedback.
-
+1 |
Beta Was this translation helpful? Give feedback.
-
+1 |
Beta Was this translation helpful? Give feedback.
-
+1 |
Beta Was this translation helpful? Give feedback.
-
Not sure what reasons there would be not to implement this. This is currently causing a significant amount of wasted time in my team, not to have a selectable default, due to various devs having different workflows. |
Beta Was this translation helpful? Give feedback.
-
+1 |
Beta Was this translation helpful? Give feedback.
-
+1 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Default Merge Strategy
Why we need it
In our GitHub organization we have a workflow where the preferred merge strategy is
Squash and merge
. Whenever we merge into master, we usually use this strategy. We would like to be able to set this as the default merge strategy, without removing the options forCreate a merge commit
andRebase and merge
for special occasions. Currently the only way to setSquash and merge
is to disable the other options. This is problematic, since we sometimes need to merge using other merge strategies in special cases, for example if the PR closes multiple issues, and we want one commit per issue it solves. Another thing that makes this hard is that currently GitHub selects the merge strategy based on what you selected ln your last PR. This means that when an unusual option is selected, the user needs to remember to change it back to the "default" so that he/she doesn't accidentally merge with the wrong strategy on their next merge. This is a big source of user errors, and can lead to multiple hours spent trying to fix the (sometimes irreversible) mistakes done by choosing the wrong merge strategy. Instead of having the default be the last selected strategy, it should be possible for repository admins to select which merge strategy is defaulted to.Suggested Implementations
Additionally, if the GitHub UX team finds it useful, it would be nice to have the default merge strategy highlighted in the merge button dropdown. Either with a different background color, or an associated emoji to show if the merge strategy is a default in the org, repo or branch.
Implementations and other relevant links
Relevant Links
Implementations by GitHub alternatives
Bitbucket Cloud (My favourite)

Bitbucket Server

Gitlab

Gitea

Edit
A partial solution involving the ability to disable certain merge methods has been implemented using repository rules. The solution can be found here: https://github.com/orgs/community/discussions/146284, and is further discussed in this comment: https://github.com/orgs/community/discussions/20583#discussioncomment-11274521
Support for choosing a default merge method per branch still remains to be implemented.
Beta Was this translation helpful? Give feedback.
All reactions