简体   繁体   English

如何将分支名称中的问题 ID 添加到合并请求描述模板?

[英]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.

相关问题 GitlabCI。 在主分支构建期间获取合并请求 ID - GitlabCI. Get merge request ID during master branch build 为什么 Gitlab 在您批准合并请求时会自动将目标分支合并到源分支? 如何禁用此行为? - Why Gitlab automatically merge target branch into source branch when you approve a merge request? How to disable this behaviour? 如何在拉/合并请求之前更新(拉)分支? - How to update(pull) a branch before a pull/merge request? 执行合并请求时如何在 GitlabCI 运行器中获取目标分支? - How to fetch the target branch in GitlabCI runner when doing merge request? 如何使用 git 将 URL 获取到我当前分支的合并请求或拉取请求? - How can I get the URL to a merge request or a pull request of my current branch using git? 当主分支恢复时,如何将我的工作分支合并到主分支? - How to merge my working branch to main branch as main branch revert? Firebase 数据库:按名称或 ID 搜索统一问题 - Firebase Database : search by name or id issue with unity 如何从谷歌云存储桶中获取项目名称/ID? - How to get project name/id from Google Cloud Storage bucket? 从请求中识别未经身份验证的 Cognito Identity ID - Identify unauthenticated Cognito Identity ID from request 如何获取运行我的 Web 应用程序的容器的 ID/名称来满足当前用户请求 - How to get the id/name of the container in which my web application is running to serve the current user request
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM