gitgithubgit-merge

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.


Solution

  • 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.