How to discuss a merge request in GitLab

Content

You need at least ‘reporter’ role in the GitLab project to be able to see the list of merge requests (MR) and at least ‘developer’ role to be able to open a MR.

If you or your colleague have already opened a Merge Request (MR) , you can have discussions with your colleagues regarding that MR.
If you have a concern, add a comment, or if your colleagues have done so, revise comments.

The GitLab page of MRs is divided into 4 pages, that you can find beneath the title of the MR:

  • ‘Overview’
  • ‘Commits’
  • ‘Pipelines’ (if applicable)
  • ‘Changes’

Step-by-step guide: Add comments and threads

You can either add general comments or add comments tied to specific lines.

If you are on the ‘Changes’ page, you could click Start a review. This allows you to write and submit multiple comments at the same time.
Stick to Add comment now, at least in the beginning.

1. Add general comments

On the bottom of the ‘Overview’ page (1) of the MR, you can add general comments and revise other people’s actions.

If you want to start a general thread , write your comment (2) then click on the arrow on the Comment button (3) and select the option Start Thread.

MR overview

2. Comment on specific lines

To discuss specific aspects, go to the page ‘Changes’ (1). Comment on specific lines (2 and 3) and start a thread (4) thereby.

MR comment on line

Optionally you can insert a suggestion.
A suggestion is a specific change and can be applied by your colleague in the GitLab web interface by one click.
See this and the screenshot in step 3, where the suggestion was to insert the word new. MR suggestion Create the syntax by clicking the marked icon (1) from the editing tools and adopting the suggestion (2) to your needs.

3. Control your results

When you are done with your comments and suggestions, go to the ‘Overview’ page and have a look at the overall MR and if your threads are displayed as expected:

MR Thread w suggestion

(1) is a general comment.
(2) is a thread on a specific line.
(3) is a suggestion within (2) and would get applied by clicking (4).

Step-by-step guide: Revise comments and threads

On the top of the ‘Overview’ page (1) of every MR you can see if there are any unresolved threads (2). (Also you can edit the MR or mark it as ready (3).)

MR unresolved thread

  1. Act on unresolved threads.
    Generally speaking there are different options:

    • Apply suggestions
      Where adequate you might just apply the suggestion (3) by clicking Apply suggestion (4).
    • Change your content
      Some threads might require changes and a new commit from you.
    • Change nothing
      You may also decide not to change your code, e.g. on feedback like (1). In many cases it is probably a good idea, to give the reasons for this in your comment (Step 2).

    MR Thread w suggestion

  2. Comment
    In most cases you should write an answer to the feedback you received. Depending on the feedback you can say ‘Thank you’ or discuss the matter of the thread.

    Type your comment to (2) in the field Reply... (5).

    You can mention the commit in a comment of the thread simply by writing its commit id, e.g. 92d2230d, you can mention issues with a preceding #, e.g. #22 and you can mention MRs with a preceding !, e.g. !13.
    See the general documentation on GitLab for the GitLab-specific Markdown.

  3. Resolve
    Mark a thread as done by clicking Resolve thread (6).

  4. Repeat the previous steps until all threads are closed.
    The MR should look like this:

    MR ready to merge

Now you might be ready to close the MR.

See also