How to open 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.

Opening a Merge Request on GitLab

If you already have a feature-branch that you want to merge , in collaborative projects it is best to open a Merge Request (MR) on GitLab , where all the collaborators can revise and discuss the new feature. Please follow these steps.

Another great possibility to open a MR is from an existing ‘Issue’, where a branch will be created as well. Please follow these steps.

Step-by-step guide: Open a MR from a branch

  1. On the GitLab web interface, navigate to MRs (1) (this might look a bit different depending on the GitLab version of the server).
    If there are no already existing MRs, you will see something like this:

    create MR1

    If there are already existing MRs, this might look more like:

    create MR1

  2. Click on New merge request (2).

  3. Select the branches to merge.
    The source branch (1) will be merged into the target branch (2). Typically the source branch will be the feature branch you were working on, while the target branch will be your ‘master’-branch.

    create MR2

  4. Click Compare branches and continue (3).

  5. Fill out the given fields.
    If ‘Title’ (1) starts with Draft: or WIP:, the MR cannot immediately be merged but discussed. We generally recommend this.

    create MR3

    Merge options (2):

    • Delete source branch ...: This is usually pre-selected and is to be ticked, when you don’t need the source branch (in this case the feature branch) anymore.
    • Squash commits ...: This would ‘squash’ all commits of your branch into a single one. We do not recommend this.

Step-by-step guide: Open a MR from an issue

  1. In GitLab navigate to your issue (1) and click on the arrow on the button Create merge request (2).

    It is convenient to open a branch and a MR belonging to it at the same time (3).
    Adapt the branch name (4) to your needs. (If you hit the main button (2), your branch will be named automatically.)

    Issue

  2. Click Create merge request (5).

  3. Proceed with step 5 as described above.
    The MR will automatically be a Draft: and when closed, the issue will also be closed.

See also