crosslinking.md 2.4 KB
Newer Older
Lab机器人's avatar
Lab机器人 已提交
1
# 关联Issue[](#关联issue "Permalink")
Lab机器人's avatar
readme  
Lab机器人 已提交
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41

请通读[GitLab 问题文档](index.html)以获取有关 GitLab 问题的概述.

## From Commit Messages[](#from-commit-messages "Permalink")

每次在提交消息中提及问题时,您都在开发工作流的两个阶段之间建立一种关系:问题本身以及与该问题相关的第一次提交.

如果问题和您要提交的代码都在同一项目中,则只需在提交消息中添加`#xxx` ,其中`xxx`是问题编号. 如果它们不在同一项目中,则可以将完整的 URL 添加到问题中( `https://gitlab.com/<username>/<projectname>/issues/<xxx>` ).

```
git commit -m "this is my commit message. Ref #xxx" 
```

or

```
git commit -m "this is my commit message. Related to https://gitlab.com/<username>/<projectname>/issues/<xxx>" 
```

当然,您可以使用自己的 GitLab 实例的 URL 替换`gitlab.com` .

**注意:**将您的第一次提交与您的问题相关联,对于通过[GitLab Cycle Analytics](https://about.gitlab.com/stages-devops-lifecycle/value-stream-analytics/)跟踪您的过程将非常重要. 它将测量计划该问题的实施所花费的时间,即从创建问题到进行第一次提交之间的时间.

## From Related Issues[](#from-related-issues "Permalink")

在合并请求中提及相关问题以及其他问题对于您的团队成员和协作者了解有关同一主题的未解决问题很有用.

如上所述,当您[从提交消息中提到问题](#from-commit-messages)时,您可以执行此操作.

当在问题`#222`提到问题`#111`时,问题`#111`还将在其跟踪器中显示一条通知. 也就是说,您只需提及一次关系即可在两个问题中均显示该关系. 在[合并请求中](#from-merge-requests)提及问题时,也是如此.

[![issue mentioned in issue](img/b962444c71ad27ba05dfc6bfc69269f4.png)](img/mention_in_issue.png)

## From Merge Requests[](#from-merge-requests "Permalink")

Mentioning issues in merge request comments works exactly the same way as they do for [related issues](#from-related-issues).

当您在合并请求说明中提到问题时,它将仅[将问题和合并请求链接在一起](#from-related-issues) . 此外,您还可以[将问题设置](managing_issues.html#closing-issues-automatically)为在合并请求合并后立即[自动关闭](managing_issues.html#closing-issues-automatically) .

[![issue mentioned in MR](img/f36631c8d1fd9cb42fb7c58a495c24be.png)](img/mention_in_merge_request.png)