Re: Proposal: Encourage squashing commits when merging

Soumyadeep Ghosh soumyadeepghosh2004 at zohomail.in
Thu May 15 20:30:32 BST 2025


This have been a problem for me also, like I have created multiple commits, and then when the MR is being merged, I would request the maintainer to specifically squash and merge to keep the consistancy. But they might forget, or that MR might be very insignificant to give it a 2nd thought. How ever, I also support that keeping a good commit history is very essential. I recently saw a similar thing being implemented in the snapcraft project, where the commit message has to pass a test. Like if I have fixed something, I must write the commit like this,


fix(folder/domain): <message>


If we can also have some sort of test like this for each repo, where the config for that repo is stored in a file and later matched, whenever there is an MR, the commit message will be compared with the given template/config. This is very much similar with the existing license validation and json validation tests that are currently being used.


Sharing the workflow that I mentioned from the snapcraft project.


https://github.com/canonical/snapcraft/actions/runs/14652070902/job/41119972837


Best Regards,


Soumyadeep Ghosh








 ---- On Thu, 15 May 2025 20:25:01 +0530  felixernst at zohomail.eu  wrote ----

Gitlab allows squashing commits while merging. I suggest to have the checkbox for this ticked by default. Contributors would still be able to untick it as they see fit.



I think "encouraging squashing" is the better default because Gitlab has features like the "Apply suggestion" button which produces non-descriptive commits by default. Furthermore especially new contributors might not manage the commit history in their merge requests. When it finally comes to merging, the merging person might forget to tick that checkbox, or they might have only recently been upgraded to a KDE developer account and not know if they should tick this non-default setting, which will then lead to a bunch of misleading/confusing/useless commits making their way to the commit history of the master branch. Even project maintainers are unable to rectify this then.



The way to change this default is described in https://invent.kde.org/help/user/project/merge_requests/squash_and_merge.md#configure-squash-options-for-a-project. However, this setting is controlled exclusively by KDE system administrators. In a short discussion with Ben Cooksley he quite reasonably suggested: "I'm afraid we need a universal consistent approach across our repositories, otherwise it will cause issues where people get surprised by different behaviour. I'd suggest starting a thread regarding the behaviour change to see what the general consensus is." (https://invent.kde.org/system/dolphin/-/merge_requests/895#note_1131215) So this is what I am now doing here.



So, does anyone mind if we change "Squash commits when merging" to "Encourage"? (https://invent.kde.org/help/user/project/merge_requests/squash_and_merge.md#configure-squash-options-for-a-project)



Felix Ernst
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-devel/attachments/20250516/1c77f769/attachment.htm>


More information about the kde-devel mailing list