MPS 2023.3 Help

Work with GitHub pull requests

Pull requests are used in open-source projects or in some corporate workflows to manage changes from contributors and to initiate code review before such changes are merged.

By creating a pull request, you tell others about the changes you want to push to the original repository, so that the maintainers of that repository can review your changes, discuss them, and integrate them into the base branch.

Create a pull request

  1. Go to Git | GitHub | Create Pull Request. The Pull Requests tool window opens.

    Pull Requests tool window with a new pull request

    In the Info tab, the repository on the left is the base repository that will receive the updates.

    The repository on the right is the head repository with the changes that will be added to the base repository.

    Alternatively, you can create a new pull request by opening the Pull Requests tab and clicking the App Expui General Add Svg icon.

  2. Click the name of the base repository on the left. In the popup that opens, specify the branch to which you want to apply your changes.

    Base repository popup
  3. Click the name of the head repository on the right. In the popup that opens, specify the branch that contains the changes you want to apply.

    Head repo popup

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

  4. Specify the name for your pull request in the Title field, and, optionally, provide a description of the changes to be applied through your request.

  5. In the Files tab, you can review the changes you are about to submit. Double-click the name of any file to open the Diff view.

  6. In the Commits tab, review the list of commits that will be included in the pull request.

    To view the details of a commit, click it to open the Diff view.

  7. Optionally, add reviewers, assign your pull request to someone or add a label to your pull request.

  8. Click Create Pull Request.

    If you are not yet ready to push your pull request, you can save it as a draft.

    • Click the App General Button Drop Triangle Svg button next to the Create Pull Request button.

    • In the menu that opens, select Create Draft Pull Request.

    Your pull request will appear in the GitHub repository as a draft. You can come back to it later by choosing Git | GitHub | View Pull Requests in the main menu.

If you have a pull_request_template.md file, MPS should add the template description to your pull requests. For more information about templates, refer to GitHub documentation.

Manage incoming pull requests

If you're a project maintainer, and you have a GitHub remote configured for your project, you can view and manage incoming pull requests directly from MPS.

To view incoming pull requests, select Git | GitHub | View Pull Requests from the main menu.

GitHub Pull Requests tool window

Use the GitHub Pull Requests tool window to:

  • Filter requests by state, author, label, assignee, and review status.

  • Jump to a pull request on GitHub: select a pull request and choose Open on GitHub from the context menu.

  • View diff between the suggested changes and the base revision: click the name of a pull request, select a file and double-click it or press Ctrl+D.

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

    Checkout branch with incoming changes

View and apply the suggested changes

If the maintainers of the original repository left comments or made suggestions with regard to your changes, you can view and apply them directly from MPS.

  1. In the main menu, go to Git | GitHub | View Pull Requests.

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

    MPS opens an overview of the selected pull request.

    Tab with an overview of the selected pull request
    • Next to the title, there is the pull request number. Click it if you want to open the pull request on GitHub.

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

    • To filter the list of changed files, select the commit you want to investigate in Changes from.

    • 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. Double-click a file to view the suggested changes and comments.

  4. You can either resolve a comment, or reply to it.

  5. If the reviewer has left a suggestion, you'll see the diff between your code and suggested one and can either Apply locally (applies a patch to the working copy) or Commit (opens a commit message pop-up).

  6. After you finished working on the pull request, you can re-request review, merge pull request or close it.

Give feedback to a pull request

You may leave individual line comments or suggest a specific change to the code lines.

Leave a comment

  1. Select a pull request and open a file in it.

  2. Click in the gutter or press Ctrl+Shift+X.

  3. Select Add a single comment to post a comment immediately or Start a review with a comment if you want to add more comments and then send them at once.

  4. Type your comment and click Comment to post it.

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

If you don't have the option to leave a comment, check your access rights to the GitHub repository.

Leave a suggestion

  1. Select a pull request and open a file in it.

  2. Click in the gutter or press Ctrl+Shift+X to leave a comment.

  3. In the comment field, add your version of the code wrapped in a Markdown code block but with the suggestion specified as a language:

    ```suggestion Your suggestion for this code line ```

    Like with comments, you can edit or delete your suggestions before you submit a review.

Submit a review

After posting a comment or a suggestion, you need to submit a review.

  1. Click Submit on the editor toolbar.

  2. Select one of the possible outcomes:

    After clicking submit, three options appear
    • Approve: to approve merging changes.

    • Request changes: to submit feedback, a pull request author must apply before merging.

    • Comment: to submit a comment without an approval.

Last modified: 07 March 2024