debian-mirror-gitlab/doc/user/project/issues/crosslinking_issues.md

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

79 lines
3 KiB
Markdown
Raw Normal View History

2020-06-23 00:09:42 +05:30
---
stage: Plan
group: Project Management
2022-11-25 23:54:43 +05:30
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/product/ux/technical-writing/#assignments
2020-06-23 00:09:42 +05:30
---
2021-09-30 23:02:18 +05:30
# Crosslinking issues **(FREE)**
2017-08-17 22:00:37 +05:30
2021-09-30 23:02:18 +05:30
There are several ways to mention an issue or make [issues](index.md) appear in each other's
2021-04-29 21:17:54 +05:30
[Linked issues](related_issues.md) section.
2017-08-17 22:00:37 +05:30
2021-04-29 21:17:54 +05:30
For more information on GitLab Issues, read the [issues documentation](index.md).
## From commit messages
2017-08-17 22:00:37 +05:30
Every time you mention an issue in your commit message, you're creating
a relationship between the two stages of the development workflow: the
issue itself and the first commit related to that issue.
If the issue and the code you're committing are both in the same project,
2021-04-29 21:17:54 +05:30
add `#xxx` to the commit message, where `xxx` is the issue number.
2017-08-17 22:00:37 +05:30
```shell
git commit -m "this is my commit message. Ref #xxx"
```
2023-04-23 21:23:45 +05:30
Since commit messages cannot usually begin with a `#` character, you may use
the alternative `GL-xxx` notation as well:
```shell
git commit -m "GL-xxx: this is my commit message"
```
2021-11-11 11:23:49 +05:30
If they are in different projects, but in the same group,
add `projectname#xxx` to the commit message.
```shell
git commit -m "this is my commit message. Ref projectname#xxx"
```
If they are not in the same group, you can add the full URL to the issue
2023-05-27 22:25:52 +05:30
(`https://gitlab.com/<username>/<projectname>/-/issues/<xxx>`).
2017-08-17 22:00:37 +05:30
```shell
2023-05-27 22:25:52 +05:30
git commit -m "this is my commit message. Related to https://gitlab.com/<username>/<projectname>/-/issues/<xxx>"
2017-08-17 22:00:37 +05:30
```
Of course, you can replace `gitlab.com` with the URL of your own GitLab instance.
2021-03-08 18:12:59 +05:30
Linking your first commit to your issue is relevant
2021-01-03 14:25:43 +05:30
for tracking your process with [GitLab Value Stream Analytics](https://about.gitlab.com/stages-devops-lifecycle/value-stream-analytics/).
2021-03-08 18:12:59 +05:30
It measures the time taken for planning the implementation of that issue,
2017-08-17 22:00:37 +05:30
which is the time between creating an issue and making the first commit.
2021-04-29 21:17:54 +05:30
## From linked issues
2017-08-17 22:00:37 +05:30
2021-04-29 21:17:54 +05:30
Mentioning linked issues in merge requests and other issues helps your team members and
collaborators know that there are opened issues regarding the same topic.
2017-08-17 22:00:37 +05:30
2019-09-30 21:07:59 +05:30
You do that as explained above, when [mentioning an issue from a commit message](#from-commit-messages).
2017-08-17 22:00:37 +05:30
2021-03-08 18:12:59 +05:30
When mentioning issue `#111` in issue `#222`, issue `#111` also displays a notification
2019-09-30 21:07:59 +05:30
in its tracker. That is, you only need to mention the relationship once for it to
display in both issues. The same is valid when mentioning issues in [merge requests](#from-merge-requests).
2017-08-17 22:00:37 +05:30
![issue mentioned in issue](img/mention_in_issue.png)
2021-04-29 21:17:54 +05:30
## From merge requests
2017-08-17 22:00:37 +05:30
2019-07-07 11:18:12 +05:30
Mentioning issues in merge request comments works exactly the same way as
2021-04-29 21:17:54 +05:30
they do for [linked issues](#from-linked-issues).
2017-08-17 22:00:37 +05:30
2021-03-08 18:12:59 +05:30
When you mention an issue in a merge request description, it
2021-04-29 21:17:54 +05:30
[links the issue and merge request together](#from-linked-issues). Additionally,
2019-09-30 21:07:59 +05:30
you can also [set an issue to close automatically](managing_issues.md#closing-issues-automatically)
as soon as the merge request is merged.
2017-08-17 22:00:37 +05:30
![issue mentioned in MR](img/mention_in_merge_request.png)