7
votes

Before starting a new issue, I always create a new branch for it (directly from Gitlab). When I finish the job on that issue (and tests are Ok), I create a merge request (from Gitlab).

After the merge is done, I have an "auto-generated" message linked to that merge (this message is very generic and identical to all merges I done).

The some thing happens also when I merge develop into master:

enter image description here

Is there a way to customize the merge request message to have a message like this:

  • Merge {shortIssueName}: {issueDescription} into {develop|master}

Note:

  • I'm using GitLab Community Edition 8.15.3.
2

2 Answers

6
votes

Globally, automatically - I don't think so. As I see, it's hard-coded:

message = [
  "Merge branch '#{source_branch}' into '#{target_branch}'",
  title
]

if !include_description && closes_issues_references.present?
  message << "Closes #{closes_issues_references.to_sentence}"
end

message << "#{description}" if include_description && description.present?
message << "See merge request #{to_reference}"

message.join("\n\n")

You can override message for any merge request manually:

enter image description here

It's also possible if you create merge request with API. It requires your time but you can build some mechanism that fetches all data with API and set it as a description (but you must ensure all is available with API, issueDescription and so on).

1
votes

Even tho @piotr-dawidiuk makes a good point, I believe is outdated.

According to gitlab docs, you can create your .md files, changing all templates. Check it here. As it states,

Similarly to issue templates, create a new Markdown (.md) file inside the .gitlab/merge_request_templates/ directory in your repository. Commit and push to your default branch.