2020-06-23 00:09:42 +05:30
---
2020-10-24 23:57:45 +05:30
stage: Create
2021-04-17 20:07:23 +05:30
group: Code Review
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-10-24 23:57:45 +05:30
type: reference, howto
2020-06-23 00:09:42 +05:30
---
2021-09-30 23:02:18 +05:30
# Comments and threads **(FREE)**
2017-08-17 22:00:37 +05:30
2023-03-17 16:20:25 +05:30
> - Paginated merge request discussions [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/340172) in GitLab 15.1 [with a flag](../../administration/feature_flags.md) named `paginated_mr_discussions`. Disabled by default.
> - Paginated merge request discussions [enabled on GitLab.com](https://gitlab.com/gitlab-org/gitlab/-/issues/364497) in GitLab 15.2.
> - Paginated merge request discussions [enabled on self-managed](https://gitlab.com/gitlab-org/gitlab/-/issues/364497) in GitLab 15.3.
> - Paginated merge request discussions [generally available](https://gitlab.com/gitlab-org/gitlab/-/issues/370075) in GitLab 15.8. Feature flag `paginated_mr_discussions` removed.
2021-09-04 01:27:46 +05:30
GitLab encourages communication through comments, threads, and
[code suggestions ](../project/merge_requests/reviews/suggestions.md ).
2017-08-17 22:00:37 +05:30
2021-12-11 22:18:48 +05:30
Two types of comments are available:
2017-08-17 22:00:37 +05:30
2021-09-30 23:02:18 +05:30
- A standard comment.
2021-11-11 11:23:49 +05:30
- A comment in a thread, which can be [resolved ](#resolve-a-thread ).
2017-08-17 22:00:37 +05:30
2021-09-30 23:02:18 +05:30
In a comment, you can enter [Markdown ](../markdown.md ) and use [quick actions ](../project/quick_actions.md ).
2018-05-09 12:01:36 +05:30
2021-09-30 23:02:18 +05:30
You can [suggest code changes ](../project/merge_requests/reviews/suggestions.md ) in your commit diff comment,
which the user can accept through the user interface.
2017-08-17 22:00:37 +05:30
2021-09-30 23:02:18 +05:30
## Places you can add comments
2019-12-21 20:55:43 +05:30
2021-09-30 23:02:18 +05:30
You can create comments in places like:
2017-08-17 22:00:37 +05:30
2021-09-30 23:02:18 +05:30
- Commit diffs
- Commits
- Designs
- Epics
- Issues
- Merge requests
- Snippets
2023-05-27 22:25:52 +05:30
- Tasks
- OKRs
2018-03-17 18:26:18 +05:30
2021-09-30 23:02:18 +05:30
Each object can have as many as 5,000 comments.
2018-03-17 18:26:18 +05:30
2022-01-26 12:08:38 +05:30
## Mentions
2022-05-07 20:08:51 +05:30
You can mention a user or a group (including [subgroups ](../group/subgroups/index.md#mention-subgroups )) in your GitLab
instance with `@username` or `@groupname` . All mentioned users are notified with to-do items and emails.
Users can change this setting for themselves in the [notification settings ](../profile/notifications.md ).
2022-01-26 12:08:38 +05:30
You can quickly see which comments involve you, because
2023-05-27 22:25:52 +05:30
mentions for yourself (the user who is signed in) are highlighted
2022-01-26 12:08:38 +05:30
in a different color.
2023-01-13 00:05:48 +05:30
Avoid mentioning `@all` in issues and merge requests. It sends an email notification
2023-05-27 22:25:52 +05:30
to all members of that project's parent group, not only the participants of the project.
It might be interpreted as spam.
2022-05-07 20:08:51 +05:30
Notifications and mentions can be disabled in
2022-08-27 11:52:29 +05:30
[a group's settings ](../group/manage.md#disable-email-notifications ).
### Mention a group in an issue or merge request
When you mention a group in a comment, every member of the group gets a to-do item
added to their To-do list.
1. Open the MR or issue.
1. In a comment, type `@` followed by the user, group, or subgroup namespace.
For example, `@alex` , `@alex-team` , or `@alex-team/marketing` .
1. Select **Comment** .
A to-do item is created for all the group and subgroup members.
2022-01-26 12:08:38 +05:30
2021-09-30 23:02:18 +05:30
## Add a comment to a merge request diff
2018-03-17 18:26:18 +05:30
2021-09-30 23:02:18 +05:30
You can add comments to a merge request diff. These comments
persist, even when you:
2018-03-17 18:26:18 +05:30
2021-09-30 23:02:18 +05:30
- Force-push after a rebase.
- Amend a commit.
2018-03-17 18:26:18 +05:30
2021-09-30 23:02:18 +05:30
To add a commit diff comment:
2018-03-17 18:26:18 +05:30
2021-09-30 23:02:18 +05:30
1. To select a specific commit, on the merge request, select the **Commits** tab, select the commit
message. To view the latest commit, select the **Changes** tab.
2021-11-11 11:23:49 +05:30
1. By the line you want to comment on, hover over the line number and select **Comment** (**{comment}**).
You can select multiple lines by dragging the **Comment** (**{comment}**) icon.
1. Enter your comment and select **Start a review** or **Add comment now** .
2018-03-17 18:26:18 +05:30
2023-01-13 00:05:48 +05:30
The comment is displayed on the merge request's **Overview** tab.
2018-03-17 18:26:18 +05:30
2021-09-30 23:02:18 +05:30
The comment is not displayed on your project's **Repository > Commits** page.
2018-03-17 18:26:18 +05:30
2021-02-22 17:27:13 +05:30
NOTE:
2021-09-30 23:02:18 +05:30
When your comment contains a reference to a commit included in the merge request,
2023-05-27 22:25:52 +05:30
it's converted to a link in the context of the merge request.
For example, `28719b171a056960dfdc0012b625d0b47b123196` becomes `28719b17` that links to
2021-09-30 23:02:18 +05:30
`https://gitlab.example.com/example-group/example-project/-/merge_requests/12345/diffs?commit_id=28719b171a056960dfdc0012b625d0b47b123196` .
2017-08-17 22:00:37 +05:30
2021-09-30 23:02:18 +05:30
## Add a comment to a commit
2017-08-17 22:00:37 +05:30
2021-09-30 23:02:18 +05:30
You can add comments and threads to a particular commit.
2017-08-17 22:00:37 +05:30
2022-10-11 01:57:18 +05:30
1. On the top bar, select **Main menu > Projects** and find your project.
2021-09-30 23:02:18 +05:30
1. On the left sidebar, select **Repository > Commits** .
1. Below the commits, in the **Comment** field, enter a comment.
1. Select **Comment** or select the down arrow (**{chevron-down}**) to select **Start thread** .
2017-08-17 22:00:37 +05:30
2021-09-30 23:02:18 +05:30
WARNING:
Threads created this way are lost if the commit ID changes after a
force push.
2017-08-17 22:00:37 +05:30
2021-09-30 23:02:18 +05:30
## Add a comment to an image
2017-08-17 22:00:37 +05:30
2021-09-30 23:02:18 +05:30
In merge requests and commit detail views, you can add a comment to an image.
This comment can also be a thread.
2017-08-17 22:00:37 +05:30
2021-09-30 23:02:18 +05:30
1. Hover your mouse over the image.
1. Select the location where you want to comment.
2017-08-17 22:00:37 +05:30
2021-09-30 23:02:18 +05:30
An icon is displayed on the image and a comment field is displayed.
2017-08-17 22:00:37 +05:30
2021-09-30 23:02:18 +05:30
## Reply to a comment by sending email
2017-08-17 22:00:37 +05:30
2021-09-30 23:02:18 +05:30
If you have ["reply by email" ](../../administration/reply_by_email.md ) configured,
you can reply to comments by sending an email.
2017-08-17 22:00:37 +05:30
2022-01-26 12:08:38 +05:30
- When you reply to a standard comment, it creates another standard comment.
2021-09-30 23:02:18 +05:30
- When you reply to a threaded comment, it creates a reply in the thread.
2022-01-26 12:08:38 +05:30
- When you [send an email to an issue email address ](../project/issues/managing_issues.md#copy-issue-email-address ),
it creates a standard comment.
2017-08-17 22:00:37 +05:30
2021-09-30 23:02:18 +05:30
You can use [Markdown ](../markdown.md ) and [quick actions ](../project/quick_actions.md ) in your email replies.
2017-08-17 22:00:37 +05:30
2022-06-21 17:19:12 +05:30
## Edit a comment
2017-08-17 22:00:37 +05:30
2021-09-30 23:02:18 +05:30
You can edit your own comment at any time.
2022-04-04 11:22:00 +05:30
Anyone with at least the Maintainer role can also edit a comment made by someone else.
2017-08-17 22:00:37 +05:30
2022-06-21 17:19:12 +05:30
To edit a comment:
1. On the comment, select **Edit comment** (**{pencil}**).
1. Make your edits.
1. Select **Save changes** .
### Editing a comment to add a mention
By default, when you mention a user, GitLab [creates a to-do item ](../todos.md#actions-that-create-to-do-items )
for them, and sends them a [notification email ](../profile/notifications.md ).
If you edit an existing comment to add a user mention that wasn't there before, GitLab:
- Creates a to-do item for the mentioned user.
- Does not send a notification email.
2023-01-13 00:05:48 +05:30
## Prevent comments by locking the discussion
2017-08-17 22:00:37 +05:30
2021-09-30 23:02:18 +05:30
You can prevent public comments in an issue or merge request.
When you do, only project members can add and edit comments.
2017-08-17 22:00:37 +05:30
2021-09-30 23:02:18 +05:30
Prerequisite:
2017-08-17 22:00:37 +05:30
2021-09-30 23:02:18 +05:30
- In merge requests, you must have at least the Developer role.
- In issues, you must have at least the Reporter role.
2017-08-17 22:00:37 +05:30
2023-01-13 00:05:48 +05:30
To lock an issue or merge request:
2021-09-30 23:02:18 +05:30
1. On the right sidebar, next to **Lock issue** or **Lock merge request** , select **Edit** .
1. On the confirmation dialog, select **Lock** .
2017-08-17 22:00:37 +05:30
2021-09-30 23:02:18 +05:30
Notes are added to the page details.
2017-08-17 22:00:37 +05:30
2021-09-30 23:02:18 +05:30
If an issue or merge request is locked and closed, you cannot reopen it.
2017-08-17 22:00:37 +05:30
2023-01-13 00:05:48 +05:30
<!-- Delete when the `moved_mr_sidebar` feature flag is removed -->
If you don't see this action on the right sidebar, your project or instance might have [moved sidebar actions ](../project/merge_requests/index.md#move-sidebar-actions ) enabled.
2022-07-16 23:28:13 +05:30
## Add an internal note
2017-08-17 22:00:37 +05:30
2022-06-21 17:19:12 +05:30
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/207473) in GitLab 13.9 [with a flag](../../administration/feature_flags.md) named `confidential_notes`. Disabled by default.
> - [Changed](https://gitlab.com/gitlab-org/gitlab/-/issues/351143) in GitLab 14.10: you can only mark comments in issues and epics as confidential. Previously, it was also possible for comments in merge requests and snippets.
2022-07-16 23:28:13 +05:30
> - [Renamed](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/87403) from "confidential comments" to "internal notes" in GitLab 15.0.
> - [Enabled on GitLab.com and self-managed](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/87383) in GitLab 15.0.
2022-08-13 15:12:31 +05:30
> - [Feature flag `confidential_notes`](https://gitlab.com/gitlab-org/gitlab/-/issues/362712) removed in GitLab 15.2.
2023-01-13 00:05:48 +05:30
> - [Changed](https://gitlab.com/gitlab-org/gitlab/-/issues/363045) permissions in GitLab 15.6 to at least the Reporter role. In GitLab 15.5 and earlier, issue or epic authors and assignees could also read and create internal notes.
2018-03-17 18:26:18 +05:30
2023-01-13 00:05:48 +05:30
You can add an internal note **to an issue or an epic** . It's then visible only to project members who have at least the Reporter role.
2022-06-21 17:19:12 +05:30
Keep in mind:
2022-07-16 23:28:13 +05:30
- Replies to internal notes are also internal.
2022-11-25 23:54:43 +05:30
- You cannot turn an internal note into a regular comment.
2022-06-21 17:19:12 +05:30
Prerequisites:
2023-01-13 00:05:48 +05:30
- You must have at least the Reporter role for the project.
2022-06-21 17:19:12 +05:30
2022-07-16 23:28:13 +05:30
To add an internal note:
2018-03-17 18:26:18 +05:30
2022-06-21 17:19:12 +05:30
1. Start adding a new comment.
2022-07-16 23:28:13 +05:30
1. Below the comment, select the **Make this an internal note** checkbox.
1. Select **Add internal note** .
2018-03-17 18:26:18 +05:30
2022-07-16 23:28:13 +05:30
![Internal notes ](img/add_internal_note_v15_0.png )
2018-03-17 18:26:18 +05:30
2022-07-16 23:28:13 +05:30
You can also mark an [issue as confidential ](../project/issues/confidential_issues.md ).
2021-10-27 15:23:28 +05:30
2021-09-30 23:02:18 +05:30
## Show only comments
2018-03-17 18:26:18 +05:30
2023-05-27 22:25:52 +05:30
In discussions with many comments, filter the discussion to show only comments or history of
changes (system notes). System notes include changes to the description, mentions in other GitLab
objects, or changes to labels, assignees, and the milestone.
GitLab saves your preference, and applies it to every issue, merge request, or epic you view.
2018-03-17 18:26:18 +05:30
2023-01-13 00:05:48 +05:30
1. Open the **Overview** tab in a merge request, issue, or epic.
2023-05-27 22:25:52 +05:30
1. On the right side of the page, from the **Sort or filter** dropdown list, select a filter:
2022-01-26 12:08:38 +05:30
- **Show all activity**: Display all user comments and system notes.
2021-09-30 23:02:18 +05:30
- **Show comments only**: Display only user comments.
- **Show history only**: Display only activity notes.
2017-08-17 22:00:37 +05:30
2023-05-27 22:25:52 +05:30
## Change activity sort order
2017-08-17 22:00:37 +05:30
2023-05-27 22:25:52 +05:30
Reverse the default order and interact with the activity feed sorted by most recent items
at the top. GitLab saves your preference in local storage and applies it to every issue,
merge request, or epic you view.
2017-08-17 22:00:37 +05:30
2023-05-27 22:25:52 +05:30
To change the activity sort order:
2022-01-26 12:08:38 +05:30
2023-05-27 22:25:52 +05:30
1. Open the **Overview** tab in a merge request, issue, or epic.
1. On the right side of the page, from the **Sort or filter** dropdown list, select the sort order
**Newest first** or **Oldest first** (default).
## View description change history **(PREMIUM)**
2022-01-26 12:08:38 +05:30
You can see changes to the description listed in the history.
To compare the changes, select **Compare with previous version** .
2021-09-30 23:02:18 +05:30
## Assign an issue to the commenting user
2017-08-17 22:00:37 +05:30
2022-08-13 15:12:31 +05:30
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/191455) in GitLab 13.1.
2017-08-17 22:00:37 +05:30
2021-09-30 23:02:18 +05:30
You can assign an issue to a user who made a comment.
2017-08-17 22:00:37 +05:30
2021-11-11 11:23:49 +05:30
1. In the comment, select the **More Actions** (**{ellipsis_v}**) menu.
1. Select **Assign to commenting user** :
![Assign to commenting user ](img/quickly_assign_commenter_v13_1.png )
1. To unassign the commenter, select the button again.
2018-03-17 18:26:18 +05:30
2021-09-30 23:02:18 +05:30
## Create a thread by replying to a standard comment
2018-03-17 18:26:18 +05:30
2021-09-30 23:02:18 +05:30
When you reply to a standard comment, you create a thread.
2018-03-17 18:26:18 +05:30
2021-09-30 23:02:18 +05:30
Prerequisites:
2018-03-17 18:26:18 +05:30
2022-04-04 11:22:00 +05:30
- You must have at least the Guest role.
2021-12-11 22:18:48 +05:30
- You must be in an issue, merge request, or epic. Threads in commits and snippets are not supported.
2018-03-17 18:26:18 +05:30
2021-09-30 23:02:18 +05:30
To create a thread by replying to a comment:
2018-03-17 18:26:18 +05:30
2023-05-27 22:25:52 +05:30
1. In the upper-right corner of the comment, select **Reply to comment** (**{comment}**).
2018-03-17 18:26:18 +05:30
2021-09-30 23:02:18 +05:30
![Reply to comment button ](img/reply_to_comment_button.png )
2018-03-17 18:26:18 +05:30
2021-12-11 22:18:48 +05:30
The reply section is displayed.
2018-03-17 18:26:18 +05:30
2021-11-11 11:23:49 +05:30
1. Enter your reply.
2022-07-23 23:45:48 +05:30
1. Select **Reply** or **Add comment now** (depending on where in the UI you are replying).
2018-03-17 18:26:18 +05:30
2021-09-30 23:02:18 +05:30
The top comment is converted to a thread.
2018-03-17 18:26:18 +05:30
2021-09-30 23:02:18 +05:30
## Create a thread without replying to a comment
2018-03-17 18:26:18 +05:30
2021-09-30 23:02:18 +05:30
You can create a thread without replying to a standard comment.
2018-03-17 18:26:18 +05:30
2021-09-30 23:02:18 +05:30
Prerequisites:
2018-03-17 18:26:18 +05:30
2022-04-04 11:22:00 +05:30
- You must have at least the Guest role.
2021-09-30 23:02:18 +05:30
- You must be in an issue, merge request, commit, or snippet.
2018-03-17 18:26:18 +05:30
2021-09-30 23:02:18 +05:30
To create a thread:
2018-03-17 18:26:18 +05:30
2021-11-11 11:23:49 +05:30
1. Enter a comment.
2023-05-27 22:25:52 +05:30
1. Below the comment, to the right of **Comment** , select the down arrow (**{chevron-down}**).
2021-09-30 23:02:18 +05:30
1. From the list, select **Start thread** .
1. Select **Start thread** again.
2018-11-20 20:47:30 +05:30
2021-09-30 23:02:18 +05:30
A threaded comment is created.
2021-03-11 19:13:27 +05:30
2021-09-30 23:02:18 +05:30
![Thread comment ](img/discussion_comment.png )
2021-03-11 19:13:27 +05:30
2021-09-30 23:02:18 +05:30
## Resolve a thread
2021-03-11 19:13:27 +05:30
2021-12-11 22:18:48 +05:30
> Resolving comments individually was [removed](https://gitlab.com/gitlab-org/gitlab/-/issues/28750) in GitLab 13.6.
2021-03-11 19:13:27 +05:30
2021-11-11 11:23:49 +05:30
In a merge request, you can resolve a thread when you want to finish a conversation.
2021-03-11 19:13:27 +05:30
2021-09-30 23:02:18 +05:30
Prerequisites:
2021-03-11 19:13:27 +05:30
2022-04-04 11:22:00 +05:30
- You must have at least the Developer role
2021-09-30 23:02:18 +05:30
or be the author of the change being reviewed.
2021-11-11 11:23:49 +05:30
- Resolvable threads can be added only to merge requests. It doesn't work
for comments in issues, commits, or snippets.
2018-12-13 13:39:08 +05:30
2021-09-30 23:02:18 +05:30
To resolve a thread:
2018-12-13 13:39:08 +05:30
2021-09-30 23:02:18 +05:30
1. Go to the thread.
1. Do one of the following:
2023-05-27 22:25:52 +05:30
- In the upper-right corner of the original comment, select **Resolve thread** (**{check-circle}**).
2021-09-30 23:02:18 +05:30
- Below the last reply, in the **Reply** field, select **Resolve thread** .
- Below the last reply, in the **Reply** field, enter text, select the **Resolve thread** checkbox, and select **Add comment now** .
2018-12-13 13:39:08 +05:30
2021-11-11 11:23:49 +05:30
At the top of the page, the number of unresolved threads is updated:
2018-12-13 13:39:08 +05:30
2022-10-11 01:57:18 +05:30
![Count of unresolved threads ](img/unresolved_threads_v15_4.png )
2018-12-13 13:39:08 +05:30
2021-09-30 23:02:18 +05:30
### Move all unresolved threads in a merge request to an issue
2018-12-13 13:39:08 +05:30
2021-09-30 23:02:18 +05:30
If you have multiple unresolved threads in a merge request, you can
2021-11-11 11:23:49 +05:30
create an issue to resolve them separately. In the merge request, at the top of the page,
2022-11-25 23:54:43 +05:30
select the ellipsis icon button (**{ellipsis_v}**) in the threads control and then select **Create issue to resolve all threads** :
2018-12-13 13:39:08 +05:30
2022-10-11 01:57:18 +05:30
![Open new issue for all unresolved threads ](img/create_new_issue_v15_4.png )
2019-07-07 11:18:12 +05:30
2021-11-11 11:23:49 +05:30
All threads are marked as resolved, and a link is added from the merge request to
2021-09-30 23:02:18 +05:30
the newly created issue.
2019-07-07 11:18:12 +05:30
2021-09-30 23:02:18 +05:30
### Move one unresolved thread in a merge request to an issue
2019-07-07 11:18:12 +05:30
2021-09-30 23:02:18 +05:30
If you have one specific unresolved thread in a merge request, you can
2021-11-11 11:23:49 +05:30
create an issue to resolve it separately. In the merge request, under the last reply
to the thread, next to **Resolve thread** , select **Create issue to resolve thread** (**{issue-new}**):
2019-07-07 11:18:12 +05:30
2021-11-11 11:23:49 +05:30
![Create issue for thread ](img/new-issue-one-thread_v14_3.png )
2019-07-07 11:18:12 +05:30
2021-11-11 11:23:49 +05:30
The thread is marked as resolved, and a link is added from the merge request to
2021-09-30 23:02:18 +05:30
the newly created issue.
2019-07-07 11:18:12 +05:30
2021-09-30 23:02:18 +05:30
### Prevent merge unless all threads are resolved
2020-06-23 00:09:42 +05:30
2021-09-30 23:02:18 +05:30
You can prevent merge requests from being merged until all threads are
2022-07-16 23:28:13 +05:30
resolved. When this setting is enabled, the **Unresolved threads** counter in a merge request
is shown in orange when at least one thread remains unresolved.
2020-06-23 00:09:42 +05:30
2022-10-11 01:57:18 +05:30
1. On the top bar, select **Main menu > Projects** and find your project.
1. On the left sidebar, select **Settings > Merge requests** .
1. In the **Merge checks** section, select the **All threads must be resolved** checkbox.
2021-09-30 23:02:18 +05:30
1. Select **Save changes** .
2020-06-23 00:09:42 +05:30
2021-09-30 23:02:18 +05:30
### Automatically resolve threads in a merge request when they become outdated
2020-06-23 00:09:42 +05:30
2021-09-30 23:02:18 +05:30
You can set merge requests to automatically resolve threads when lines are modified
with a new push.
2020-06-23 00:09:42 +05:30
2022-10-11 01:57:18 +05:30
1. On the top bar, select **Main menu > Projects** and find your project.
1. On the left sidebar, select **Settings > Merge requests** .
1. In the **Merge options** section, select
**Automatically resolve merge request diff threads when they become outdated** .
2021-09-30 23:02:18 +05:30
1. Select **Save changes** .
2020-06-23 00:09:42 +05:30
2021-09-30 23:02:18 +05:30
Threads are now resolved if a push makes a diff section outdated.
Threads on lines that don't change and top-level resolvable threads are not resolved.