Reputation: 16992
By default GitLab adds issue ID from branch name to the merge request description, see Merge requests to close issues:
Merge requests to close issues
To create a merge request to close an issue when it’s merged, you can either:
Add a note in the MR description.
In the issue, select Create a merge request. Then, you can either:
- Create a new branch and a draft merge request in one action. The branch is named
issuenumber-title
by default, but you can choose any name, and GitLab verifies that it’s not already in use. The merge request inherits the milestone and labels of the issue, and is set to automatically close the issue when it is merged.- Create a new branch only, with its name starting with the issue number.
But I want to use a custom merge request description template, see Create a merge request template:
Create a merge request template
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.
Research
Question
How to add issue ID from branch name to the merge request description template?
Upvotes: 5
Views: 2217
Reputation: 71
I'm looking for a similar problem, i see that Push Options can be a solution for this: https://docs.gitlab.com/ee/user/project/push_options.html for example:
merge_request.title="<title>" Set the title of the merge request.
merge_request.description="<description>" Set the description of the merge request.
It is true that this must be set up by the developer on the client side, but with git hooks and shell scripts, the content can be anything!
Upvotes: 1