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
- GitLab Flavored Markdown doesn't contain any markup for the issue ID from the branch name.
- Markdown Style Guide for about.GitLab.com doesn't contain any markup for the issue ID from the branch name.
- GitLab quick actions doesn't contain any action for the issue ID from the branch name.
Question
How to add issue ID from branch name to the merge request description template?