Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to specify a default option for merging a pull request in GitHub?

I'm working on a project where "squash and merge" is the preferred approach for merging pull requests. Is there a way to make this the default option in GitHub, either for my own user, or for the project?

As it stands, it's entirely too easy to select the default option (Create a merge commit). This is made especially problematic by the fact that it is not easily undo-able, given that you generally should not be modifying repository history.

Note that this is different than How to make --squash default on a merge?, as that one refers to the command line usage of Git, whereas my question concerns functionality within the GitHub user interface.

like image 424
M. Justin Avatar asked Mar 09 '18 22:03

M. Justin


People also ask

How do I set squash and merge as default?

Navigate to 'Settings' in your repository and scroll down to the Pull Requests section. Select Allow squash merging and then select Default to PR title for squash merge commits.

What is git default merge strategy?

Recursive is the default merge strategy when pulling or merging one branch. Additionally this can detect and handle merges involving renames, but currently cannot make use of detected copies. This is the default merge strategy when pulling or merging one branch.

How do I merge Pull Requests in GitHub?

Adding a pull request to a merge queueOn GitHub.com, navigate to the main page of the repository. Under your repository name, click Pull requests. In the "Pull Requests" list, click the pull request you would like to add to a merge queue. Click Merge when ready to add the pull request to the merge queue.


1 Answers

The GitHub user interface will default the option to the last option selected by the user for the current project. This solves the issue of not accidentally using the wrong default, since after the merge is done correctly for the first PR, subsequent merges will have the desired default.

This solution isn't perfect. If a user makes an intentional one-off merge of a different type, they will need to remember to set it back for their next merge, as the default will have changed to what was intended to be a one-off deviation from the norm.

like image 83
M. Justin Avatar answered Sep 27 '22 20:09

M. Justin