provide squash option when merging merge requests
Add a checkbox "Squash into one commit" below "Merge" button of a merge request. The default state of that checkbox should be configurable per instance and per project.
The UI would ask for a commit message (defaulting to branch name) and then execute the equivalent of 'git checkout other-branch; git merge --squash this-branch; git commit -m "commit-message", close the merge request and delete the branch (if the other checkbox is ticked).
This is a common workflow in projects and not supporting it causes a lot of confusion and extra work.
Andrew Meyer commented
@Gerard "Once the commit has been pushed, the oppoortunity for squashing has been lost" That's actually not true. After the code review is complete, you can squash + force push.
Gerard Stannard commented
Having to squash locally at the command line means we don't push small commits for immediate code review feedback. Once the commit has been pushed, the oppoortunity for squashing has been lost, so developers tend not to commit until they're ready to squash many small commits.
Jody Mulkey commented
Currently, merging using the GitLab UI results in all commits within the source branch being inserted into the history of the target branch. For a large feature or fix with lots of commits, this clutters the target branch with potentially extraneous commits. This clutter can make it difficult to cherry-pick features/bug fixes into and out of other branches (for releases, for example), and build clean release notes.
This can be worked around by doing manual command-line steps to merge the source into the target. It would be extremely convenient, however, to do this from the GitLab UI.
Erik Donohoo commented
I can't stress how important this is. It would be magnificent to have this.
Ryan Shelley commented
This would be extremely useful as part of our GitFlow process to be able to create releases of individual features. More importantly, the ability to extract a problematic feature from a release (feature that wasn't completely tested or is buggy). Otherwise it's difficult to revert the individual commits of a feature to remove it from a release.
Maxime Brugidou commented
Ciro Santilli commented