1
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
|
---
stage: Create
group: Code Review
info: "To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments"
type: reference, howto
---
# Comments and threads **(FREE)**
GitLab encourages communication through comments, threads, and
[code suggestions](../project/merge_requests/reviews/suggestions.md).
Two types of comments are available:
- A standard comment.
- A comment in a thread, which can be [resolved](#resolve-a-thread).
In a comment, you can enter [Markdown](../markdown.md) and use [quick actions](../project/quick_actions.md).
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.
## Places you can add comments
You can create comments in places like:
- Commit diffs
- Commits
- Designs
- Epics
- Issues
- Merge requests
- Snippets
Each object can have as many as 5,000 comments.
## Mentions
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).
You can quickly see which comments involve you, because
mentions for yourself (the user currently signed in) are highlighted
in a different color.
Avoid mentioning `@all` in issues and merge requests, because it sends an email notification
to all the members of that project's group. This might be interpreted as spam.
Notifications and mentions can be disabled in
[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.
## Add a comment to a merge request diff
You can add comments to a merge request diff. These comments
persist, even when you:
- Force-push after a rebase.
- Amend a commit.
To add a commit diff comment:
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.
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**.
The comment is displayed on the merge request's **Discussions** tab.
The comment is not displayed on your project's **Repository > Commits** page.
NOTE:
When your comment contains a reference to a commit included in the merge request,
it's automatically converted to a link in the context of the current merge request.
For example, `28719b171a056960dfdc0012b625d0b47b123196` becomes
`https://gitlab.example.com/example-group/example-project/-/merge_requests/12345/diffs?commit_id=28719b171a056960dfdc0012b625d0b47b123196`.
## Add a comment to a commit
You can add comments and threads to a particular commit.
1. On the top bar, select **Menu > Projects** and find your project.
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**.
WARNING:
Threads created this way are lost if the commit ID changes after a
force push.
## Add a comment to an image
In merge requests and commit detail views, you can add a comment to an image.
This comment can also be a thread.
1. Hover your mouse over the image.
1. Select the location where you want to comment.
An icon is displayed on the image and a comment field is displayed.
## Reply to a comment by sending email
If you have ["reply by email"](../../administration/reply_by_email.md) configured,
you can reply to comments by sending an email.
- When you reply to a standard comment, it creates another standard comment.
- When you reply to a threaded comment, it creates a reply in the thread.
- When you [send an email to an issue email address](../project/issues/managing_issues.md#copy-issue-email-address),
it creates a standard comment.
You can use [Markdown](../markdown.md) and [quick actions](../project/quick_actions.md) in your email replies.
## Edit a comment
You can edit your own comment at any time.
Anyone with at least the Maintainer role can also edit a comment made by someone else.
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.
## Prevent comments by locking an issue
You can prevent public comments in an issue or merge request.
When you do, only project members can add and edit comments.
Prerequisite:
- In merge requests, you must have at least the Developer role.
- In issues, you must have at least the Reporter role.
1. On the right sidebar, next to **Lock issue** or **Lock merge request**, select **Edit**.
1. On the confirmation dialog, select **Lock**.
Notes are added to the page details.
If an issue or merge request is locked and closed, you cannot reopen it.
## Add an internal note
> - [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.
> - [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.
> - [Feature flag `confidential_notes`](https://gitlab.com/gitlab-org/gitlab/-/issues/362712) removed in GitLab 15.2.
You can add an internal note **to an issue or an epic**. It's then visible only to the following people:
- Project members who have at least the Reporter role
- Issue or epic author
- Users assigned to the issue or epic
Keep in mind:
- Replies to internal notes are also internal.
- You can not turn an internal note into a regular comment.
Prerequisites:
- You must either:
- Have at least the Reporter role for the project.
- Be the issue or epic assignee.
- Be the issue or epic author.
To add an internal note:
1. Start adding a new comment.
1. Below the comment, select the **Make this an internal note** checkbox.
1. Select **Add internal note**.
![Internal notes](img/add_internal_note_v15_0.png)
You can also mark an [issue as confidential](../project/issues/confidential_issues.md).
## Show only comments
For issues and merge requests with many comments, you can filter the page to show comments only.
1. Open a merge request's **Discussion** tab, or epic or issue's **Overview** tab.
1. On the right side of the page, select from the filter:
- **Show all activity**: Display all user comments and system notes.
(issue updates, mentions from other issues, changes to the description, and so on).
- **Show comments only**: Display only user comments.
- **Show history only**: Display only activity notes.
![Notes filters dropdown options](img/index_notes_filters.png)
GitLab saves your preference, so it persists when you visit the same page again
from any device you're logged into.
## View description change history **(PREMIUM)**
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/10103) in GitLab 12.6.
You can see changes to the description listed in the history.
To compare the changes, select **Compare with previous version**.
## Change activity sort order
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/14588) in GitLab 12.10.
You can reverse the default order and interact with the activity feed sorted by most recent items
at the top. Your preference is saved in local storage and automatically applies to every issue,
merge request, or epic you view.
To change the activity sort order:
1. Select the **Oldest first** (or **Newest first**) dropdown list.
1. Select either oldest or newest items to be shown first.
## Assign an issue to the commenting user
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/191455) in GitLab 13.1.
You can assign an issue to a user who made a comment.
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.
## Create a thread by replying to a standard comment
When you reply to a standard comment, you create a thread.
Prerequisites:
- You must have at least the Guest role.
- You must be in an issue, merge request, or epic. Threads in commits and snippets are not supported.
To create a thread by replying to a comment:
1. On the top right of the comment, select **Reply to comment** (**{comment}**).
![Reply to comment button](img/reply_to_comment_button.png)
The reply section is displayed.
1. Enter your reply.
1. Select **Reply** or **Add comment now** (depending on where in the UI you are replying).
The top comment is converted to a thread.
## Create a thread without replying to a comment
You can create a thread without replying to a standard comment.
Prerequisites:
- You must have at least the Guest role.
- You must be in an issue, merge request, commit, or snippet.
To create a thread:
1. Enter a comment.
1. Below the comment, to the right of the **Comment** button, select the down arrow (**{chevron-down}**).
1. From the list, select **Start thread**.
1. Select **Start thread** again.
A threaded comment is created.
![Thread comment](img/discussion_comment.png)
## Resolve a thread
> Resolving comments individually was [removed](https://gitlab.com/gitlab-org/gitlab/-/issues/28750) in GitLab 13.6.
In a merge request, you can resolve a thread when you want to finish a conversation.
Prerequisites:
- You must have at least the Developer role
or be the author of the change being reviewed.
- Resolvable threads can be added only to merge requests. It doesn't work
for comments in issues, commits, or snippets.
To resolve a thread:
1. Go to the thread.
1. Do one of the following:
- In the top right of the original comment, select the **Resolve thread** (**{check-circle}**) icon.
- 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**.
At the top of the page, the number of unresolved threads is updated:
![Count of unresolved threads](img/unresolved_threads_v15.png)
### Move all unresolved threads in a merge request to an issue
If you have multiple unresolved threads in a merge request, you can
create an issue to resolve them separately. In the merge request, at the top of the page,
select **Create issue to resolve all threads** (**{issue-new}**):
![Open new issue for all unresolved threads](img/create-new-issue_v15.png)
All threads are marked as resolved, and a link is added from the merge request to
the newly created issue.
### Move one unresolved thread in a merge request to an issue
If you have one specific unresolved thread in a merge request, you can
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}**):
![Create issue for thread](img/new-issue-one-thread_v14_3.png)
The thread is marked as resolved, and a link is added from the merge request to
the newly created issue.
### Prevent merge unless all threads are resolved
You can prevent merge requests from being merged until all threads are
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.
1. On the top bar, select **Menu > Projects** and find your project.
1. On the left sidebar, select **Settings > General**.
1. Expand **Merge requests**.
1. Under **Merge checks**, select the **All threads must be resolved** checkbox.
1. Select **Save changes**.
### Automatically resolve threads in a merge request when they become outdated
You can set merge requests to automatically resolve threads when lines are modified
with a new push.
1. On the top bar, select **Menu > Projects** and find your project.
1. On the left sidebar, select **Settings > General**.
1. Expand **Merge requests**.
1. Under **Merge options**, select the
**Automatically resolve merge request diff threads when they become outdated** checkbox.
1. Select **Save changes**.
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.
## Display 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.
> - [Enabled on GitLab.com](https://gitlab.com/gitlab-org/gitlab/-/issues/364497) in GitLab 15.2.
> - [Enabled on self-managed](https://gitlab.com/gitlab-org/gitlab/-/issues/364497) in GitLab 15.3.
FLAG:
On self-managed GitLab, by default this feature is available. To hide the feature
per project or for your entire instance, ask an administrator to
[disable the feature flag](../../administration/feature_flags.md) named `paginated_mr_discussions`.
On GitLab.com, this feature is available.
A merge request can have many discussions. Loading them all in a single request
can be slow. To improve the performance of loading discussions, they are split into multiple
pages, loading sequentially.
|