Add an Inline Comment to a File

When a code review is in progress, you can add inline comments directly to the lines of code in a file. You can’t, however, add an inline comment after a merge request has been merged or closed.

Here's how to add inline comments directly to the source code being reviewed:

  1. Open the merge request.
  2. Click the Changed Files tab.
  3. Mouse-over the line number of the file where you want to add your comment and click Add CommentAdd Comment icon.
  4. Add your comment in the comment box.
    • Use the project’s wiki markup language to format the comment.

    • Click Comment to publish it and make it visible to all reviewers.

      You can’t edit or delete a published comment.

    • Click Save to save the comment and publish it later. The comment isn’t published so it isn’t visible to reviewers.

    • Click Cancel to discard the comment. It won't be added.

Click the Pending Comments tab to see your pending or unpublished comments.

To reply to a published comment, click Reply reply, enter your comment, and click Reply. Replies to published comments will be published immediately but you can only edited or deleted them if you added them. In addition, you can't edit or delete comments added by other users. You can only reply to those.

To filter published comments, select Filter and enter a term or partial string to filter by.

To edit one of your comments, select the comment and then click Edit Edit icon. Make your changes and then click Save to post your edited comment.

Manage Unpublished Comments

The Pending Comments tab displays all pending comments with the code where these comments were added. The comments appear inline in the code.

Here are several things you can do with unpublished comments:

  • To edit a comment, click Edit Edit.

  • To publish a pending comment, click Publish to the right side of the comment header.

  • To publish all pending comments, click Publish All.

  • To discard all pending comments, click Discard All.

  • To delete a comment, click Delete Delete.