Squash merge MRs without merge commit
I’m was very happy to see that squash merges is now possible in 8.17. However, I was surprised with the behavior of squash merging a MR. The current behavior makes using squash not useful for us.
Background: We create MRs for everything from trivial one line bug fixes to big features. With bigger MR:s we want merge commits and keep the MR commit history. We're very happy with the "Merge commit semi-linear history" setting. However, for trivial changes we just want to have one single squashed commit merged to master. Currently we create MR:s but then cherry-pick the single commit and manually close the MR:s.
In GitLab wording, when I merge MR I want either:
- “Merge commit semi-linear history without squash” (a merge commit that groups the commits in the MR that gives a nice history)
- “Fast-forward merge with squash” (squash all of the MR to a single commit that lands in master without merge commit)
I don't see how creating a merge commit when squashing is useful no matter what kind of setting is used for merging. The reason we want to do squash in the first place is to have one commit land in the master branch without merge commits. It makes the history much nicer and avoids an extra merge commit. The option to merge with a merge commit is already there: just do a regular merge! :)
Squash in my mind means "take all the diffs, make one commit out of them and merge it at the top of the target branch". Additional arguments why this behavior is generally what squash merge means:
-
git merge --squash
produces a single commit (not a merge commit and the real commit) - GitHub squashes PR merge commits into one commit without a merge commit. Merge commits does not happen when squash-merging a PR.