MR Title and Description should be pre-filled from first multiline commit message
Ultimate customer here:
Proposal
When creating a merge request, the title and description should be pre-filled using the first multiline commit message. This behavior already exists for Squash and Merge commit messages. This proposal simply brings MR titles and descriptions in line with Squash and Merge commit messages.
This excerpt from Squash and Merge describes how squash commit messages work:
The squashed commit’s commit message will be either:
- Taken from the first multi-line commit message in the merge.
- The merge request’s title if no multi-line commit message is found.
The second bullet point is not relevant to this proposal. But the first bullet describes how this proposed feature should work.
Example:
Let's say I make three commits like
commit 30542c9e21cd8ffa6f8b53702b4a4999f4b65332 (HEAD, gitlab/commit-message-template, develop)
Author: Max 🧙♂️ Coplan <mail@kr.af.mil>
Date: Fri Jan 29 16:30:21 2021 -0500
feedback and testing
commit dcd270581872c76a8ff737e87a6013f017fcdfe7
Author: Max 🧙♂️ Coplan <mail@kr.af.mil>
Date: Fri Jan 29 16:30:00 2021 -0500
Closes WA-111 : short description
## Changelog
- A thing
- Another thing
----
commit 23b588519f9da0c69530583aa704fd051e71e9bc
Author: Max 🧙♂️ Coplan <mail@kr.af.mil>
Date: Fri Jan 29 16:29:48 2021 -0500
init
Then push it to gitlab like
❯ gp gitlab @:refs/heads/commit-message-template --force
Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
remote:
remote: To create a merge request for commit-message-template, visit:
remote: https://gitlab.com/wingops/aviato/aviato-app/-/merge_requests/new?merge_request%5Bsource_branch%5D=commit-message-template
remote:
To gitlab.com:wingops/aviato/aviato-app.git
+ 834e04b1...30542c9e HEAD -> commit-message-template (forced update)
If I click on the link in the remote response, I would like to see
However, instead I get
What is interesting about the actual result is that GitLab's Merge Request documentation actually describes a different behavior
On the New Merge Request page, start by filling in the title and description for the merge request. If there are already commits on the branch, the title is prefilled with the first line of the first commit message, and the description is prefilled with any additional lines in the commit message
In the actual result, you can see that GitLab does not prefill the first commit "init", but instead prefills a formatted version of the branch name: commit-message-template
→"Commit message template".
Either way, I think having consistent behavior between squash commit messages and MR title and description is an improvement that would be appreciated by GitLab's users.