Work with GitLab merge requests
Using GitLab merge requests, you can incorporate changes from a source branch to a target branch.
Tools overview
To view incoming merge requests, click in the tool window bar on the left.
Alternatively, go to
in the main menu.Use the Merge Requests tool window to:
Review merge requests: browse code, check diff between the suggested changes and the base revision, and leave comments directly from PyCharm.
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.
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.
When you select a merge request and double-click it, you will see the merge request details tab:
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 requests consists of several commits, focus on a specific one by selecting it in the Changes from drop-down. 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.
Create a merge request
In the main menu, go to
.In the Merge Requests tool window that opens, click Create Merge Request in the top-right corner.
A new tab opens with a merge request draft.
Click the name of the base repository on the left and specify the branch that will receive the updates.
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.
If you have a project that uses multiple remote repositories, you can change the head repository in this popup as well.
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.
Click Create Merge Request.
Send your merge request for review
You can send your existing GitLab merge requests for review directly from PyCharm.
Request review
Click in the tool window bar on the left.
Select your merge request from the list and double-click it. PyCharm opens an overview of the selected merge request.
At the bottom of the details view, click the Request Review button.
Find the name of the reviewer in the search field or select the reviewer in the list of suggested reviewers.
If someone left comments to your merge request, you can view and answer them directly in PyCharm.
Work with comments
Click in the tool window bar on the left.
Select the merge request from the list and double-click it. PyCharm opens an overview of the selected merge request.
Double-click a file to view the comments.
You can either reply to a comment, or resolve it.
After you finished working on the merge request, you can re-request review, merge, or close it in the same merge request details tab.
Review merge request
When reviewing a merge request, you can leave your comments directly in PyCharm.
Leave your comments
Select a merge request and open a file in it.
Click in the gutter.
Type your comment and click Add Comment to post it.
Before you submit a review, you can edit or delete your comments.
After posting your comments, you can submit the review and approve the merge request.
Submit review
Click Submit Review in the merge request details tab.
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.