RubyMine 2024.3 Help

Work with GitLab merge requests

Using GitLab merge requests, you can incorporate changes from a source branch to a target branch.

Create a merge request

  1. In the main menu, go to Git | GitLab | View Merge Requests.

  2. In the Merge Requests tool window that opens, click Plus Create Merge Request in the top-right corner.

    A new tab opens with a merge request draft.

    Merge Requests tool window with a new merge request
  3. Click the name of the base repository on the left and specify the branch that will receive the updates.

    Base repository
  4. Click the name of the head repository on the right and specify the branch with the changes that will be added to the base repository.

    Head repository

    If you have a project that uses multiple remote repositories, you can change the head repository in this popup as well.

  5. Specify the name for your merge request in the Title field, and, optionally, provide a description of the changes to be applied through your request and add reviewers.

  6. Click Create Merge Request.

Manage incoming merge requests

To view incoming merge requests, click GitLab icon in the tool window bar on the left.

Merge requests filters

Alternatively, go to Git | GitLab | Show GitLab Merge Requests in the main menu.

Use the Merge Requests tool window to:

  • Review merge requests: browse code, check the diff between the suggested changes and the base revision, and leave comments directly from RubyMine.

  • Filter requests by state, author, assignee, reviewer, and label.

  • Jump to a merge request on GitLab: right-click a merge request and choose Open Merge Request on GitLab from the context menu.

  • Create a local branch based on incoming changes: open a merge request, click the branch with incoming changes, and choose Checkout 'branch name' in the context menu.

    Checkout branch with incoming changes
  • Investigate branch-related changes in the Log tab of the Git tool window: open a merge request, click the branch with incoming changes, and choose Show 'branch name' in Git Log in the context menu.

    This will help you navigate the code related to this merge request, make sure the project builds and the tests pass.

  • Resolve merge conflicts: if the branch in an incoming merge request has merge conflicts, you can resolve them right from the Merge Requests tool window either by creating a merge commit from the target branch or by rebasing onto the target branch.

    Option to resolve merge conflicts

To make sure you always have the latest information about the merge requests, press Ctrl+F5. Alternatively, right-click the necessary merge request and select Refresh List.

Give feedback to a merge request

When there are changes that require your attention, a white dot marks the GitLab tool window and the unseen merge requests are marked with blue dots.

  1. In the main menu, go to Git | GitLab |View Merge Requests.

  2. In the list of merge requests, select the one you want to work with and double-click it.

    RubyMine opens an overview of the selected merge request.

    Merge Request overview
    • Next to the title, there is a merge request number. Click it if you want to open the merge request on GitLab.

    • Click the View Timeline button to open the merge request timeline.

    • If a merge request consists of several commits, focus on a specific one by selecting it in the Changes from drop-down menu. Navigate between commits by pressing the up and down buttons.

    • Right-click any file to open the context menu for this file.

    • In case a reviewer has left any comments or suggestions, there is a counter with the number of comments in the list of files.

  3. Click the branch with incoming changes and choose Checkout 'branch name' in the context menu to start the review mode.

    Checkout branch with incoming changes
  4. Select the file you want to investigate, right-click it and select Jump to Source F4 from the context menu.

    In the file that opens, pink markers in the gutter indicate the changes and the comments that are available for review.

    Clicking the comment icons in the gutter will hide and open the comments.

    Changes and comments in the review mode

    Clicking the pink markers reveals a popup displaying the original code.

    Review mode - view differences
  5. Hover over the gutter and click to leave a comment.

    Comment field with a suggestion
    • Select Add Comment to post a comment immediately and get other reviewers notified.

    • Select Save as draft to add multiple comments.

      Before you submit your review, your comments are marked Pending, and you can edit or delete them.

  6. To place a high-level comment on a merge request as a whole, open the timeline view of this merge request.

  7. Click Submit Review in the merge request details tab to submit the review or approve the merge request.

    Submit review dialog

    Select one of the possible outcomes:

    • Approve: to approve merging changes.

    • Submit: to submit your feedback without an approval.

    If you change your mind, you can later click the Revoke Approval button.

If the work with the merge request is done, you can merge or close it in the same merge request details tab.

Work with comments in your merge request

If someone left comments to your merge request, you can resolve them or leave your answers directly in RubyMine.

  1. In the main menu, go to Git | GitLab | View Merge Requests or click GitLab icon in the tool window bar on the left.

  2. Select the merge request from the list and double-click it. RubyMine opens an overview of the selected merge request.

  3. Double-click a file to view the suggested changes.

  4. You can resolve a comment, reply to it, or leave your reaction.

After you finished working on the merge request, you can re-request review, merge, or close it in the same merge request details tab.

Merge or close a merge request

After submitting your review and solving all the issues, you can merge or close the merge request.

  1. In the main menu, go to Git | GitLab | View Merge Requests.

  2. In the list of merge requests, select the one you want to work with and double-click it.

  3. At the bottom of the overview, there is a button with merge options that differ depending on the stage of the review process.

    • If you have approved the updates after your review, you can merge the merge request by clicking Merge.

      For more merge options, click the Down arrow and select Squash and Merge to squash the commits with your changes into one before merging them.

    • Click More and select Request Review if you need another opinion on this merge request or Close Merge Request if you do not want to merge it.

Last modified: 11 November 2024