RubyMine 2022.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. From the main menu, choose Git | GitHub | Create Pull Request. The Create Pull Request dialog opens.

  2. Under Base Fork, specify the project that you want to send the pull request to. Either select a repository from the list populated by RubyMine, or click Select Other Fork.

  3. Under Base Branch, specify the branch in the target project that your changes will be applied to. Click Show Diff to review the list of commits that will be included in the pull request. To view the details of a commit, select it and switch to the Log tab of the Version Control tool window Alt+9, where you can see a list of files included in the selected commit, view diff, and so on.

  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.

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 RubyMine.

  1. From the main menu, select Git | GitHub | View Pull Requests.

  2. Open the Files tab. To the right of each file, you'll see a counter with the number of comments or suggestions a reviewer has left.

  3. Open a file to view the comments.

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

    GitHub review comment
  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).

    GitHub suggested change apply locally

Both comments and suggestions are also displayed in the pull request timeline in the Info tab.

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 RubyMine.

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

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, switch to the Files tab, select a file and click it or press Ctrl+D.

    View Diff for a file in an incoming pull request
  • Create a local branch based on incoming changes: select a pull request and choose Create New Local Branch from the context menu.

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 App modules add content entry dark 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 Platform impl icons send to post it.

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

Leave a suggestion

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

  2. Click App modules add content entry dark 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 ```

Submit a review

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

  1. Click Submit on the 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 approval.

Last modified: 28 November 2022