Override squash commit message
(Backend issue: #56014 (closed))
When fixing a bug or adding a feature with a single commit, I write a detailed commit message describing why the change was needed and what the change does. When I receive feedback from other developers I will make multiple small commits to fix my change, but if I squash and merge my nice commit message is erased even though it describes my change in detail and would be useful in the future.
The current behavior is to use the merge request title as the squash commit message. If the merge request was created from an issue, the commit message can be even worse Resolve "Select commit message in squashed commit"
We should improve the default behavior of squash and merge to make it less destructive.
Proposal
- If the merge request contains commits with long commit messages (signal of a deliberate commit message) automatically select the first long commit message as the squash commit message.
- Otherwise, default to the merge request title
- The squash commit message should be editable
- Basic: editable text field
- Bonus: select a commit message from any of the commits in the merge request
Designs
Squash commits enabled
Collapsed | Expanded | Dropdown |
---|---|---|
- The longest commit message available will be used as the default value of the squash commit message text box.
- Modifying the author of the squash commit is out of scope for this issue. Will be implemented in https://gitlab.com/gitlab-org/gitlab-ee/issues/1510.
- Bonus (This is a nice-to-have and can be implemented in a later iteration)
- "Include all commit messages" checkbox will append all the commit messages at the end of the text in the squash commit message textbox. (to be tackled in https://gitlab.com/gitlab-org/gitlab-ce/issues/56735)
- The "Use an existing commit message" dropdown allows the user to pick an existing commit message to replace the text in the textbox.
Squash commits not enabled
Collapsed | Expanded |
---|---|
- The UI for modifying merge commit has been changed for the sake of consistency.
- The include MR description toggle link has been changed into a checkbox which is a better design pattern.
- The hover color of the gray bar is
#CCCCCC
(mockup) - Mockup of the MR widget with security/test reports
- When fast-forward merge is enabled, the gray bar in the bottom of the merge section is hidden. (mockup)