[英]How to add issue ID from branch name to merge request description template?
By default GitLab adds issue ID from branch name to the merge request description, see Merge requests to close issues :默认情况下 GitLab 将分支名称中的问题 ID 添加到合并请求描述中,请参阅合并请求以关闭问题:
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.在 MR 描述中添加注释。
In the issue, select Create a merge request .在问题中, select创建合并请求。 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.该分支默认命名为issuenumber-title
,但您可以选择任何名称,GitLab 会验证它尚未使用。 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.与问题模板类似,在存储库的.gitlab/merge_request_templates/
目录中创建一个新的 Markdown (.md
) 文件。 Commit and push to your default branch.提交并推送到您的默认分支。
Research研究
Question问题
How to add issue ID from branch name to the merge request description template?如何将分支名称中的问题 ID 添加到合并请求描述模板中?
I'm looking for a similar topic, I see that Push Options can be a solution for this: https://docs.gitlab.com/ee/user/project/push_options.html for example:我正在寻找类似的主题,我看到推送选项可以解决这个问题: https://docs.gitlab.com/ee/user/project/push_options.ZFC35FDC70D5FC69D2569883A82E2
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?确实这必须由开发者在客户端设置,但是有了 git 钩子和 shell 脚本,内容可以是什么? What do you think?你怎么看?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.