Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to customize a merge request message on Gitlab?

Tags:

gitlab

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.
like image 563
Ala Eddine JEBALI Avatar asked Mar 14 '17 13:03

Ala Eddine JEBALI


People also ask

How do I change the commit message in merge request?

Change the commit message. You can use git commit --amend for the latest commit change. It must be the latest commit. Amend it.

How do you edit a commit message in GitLab?

On the command line, navigate to the repository that contains the commit you want to amend. Type git commit --amend and press Enter. In your text editor, edit the commit message, and save the commit.

How do I add changes to a merge request?

Revise a merge request If you need to update a merge request (for example in response to a request from the review shifter), simply push to the same branch again after editing (and testing) the files.


2 Answers

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).

like image 153
Piotr Dawidiuk Avatar answered Nov 08 '22 19:11

Piotr Dawidiuk


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.

like image 34
genuinefafa Avatar answered Nov 08 '22 19:11

genuinefafa