Skip to content

Add a custom commit message when applying a suggested change

Problem to solve

Suggesting a change in a merge request makes it easy to propose and apply feedback to a merge request. Because the commit message cannot be modified:

  • at best, the commit message contains no useful information
  • at worst, the commit message will violate project commit message hygiene rules and break the build

In both cases, the author of the merge request has two ways to resolve the situation:

  • squash the whole merge request (which is not always enabled, and might be disabled), which may not be desirable if there are multiple well written commits
  • fetch the branch locally, perform an interactive rebase to reword the commits to something useful

Good commit hygiene is considered a best practice. GitLab should encourage and enable these kinds of best practices. This feature currently creates a problem and requires workarounds that remove information, or significant manual work.

Proposal

  • When clicking on the "Apply suggestion" button, the user should be prompted for a custom commit message.
  • The commit message is optional and the form will have a placeholder commit message as a default.
  • The placeholder commit message should come from the default commit message for suggestions.

Workflow:

  1. Click on "apply suggestion" button
  2. Reveal commit message text box
  3. Update placeholder commit if desired
  4. Commit

image

There is an existing UI pattern for this in the Web IDE:

2020-11-05_12.31.40

Further details

GitHub requires the user applying a suggestion to review the commit message, and makes it possible to update.

screenshot

image

( nice z-index...)

Edited by Pedro Moreira da Silva