Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to review a pull request in IntelliJ IDEA?

We are using git, Bitbucket, and IntelliJ IDEA. The project is mainly written in Java and Groovy.

Is there a good way to review pull requests right from IntelliJ?

like image 273
galusben Avatar asked Oct 24 '16 11:10

galusben


People also ask

How do you review and edit a pull request?

Working on the pull request The person who is submitting the pull request can also see the comments. If you're working on the pull request, you have to make the necessary changes. To do so, you go back to your forked repository and update the same branch you used to submit the pull request.

Can you review your own pull request?

To review a pull request you will need someone (who is not the person who created the pull request) to: Open the pull request and click on the Files changed tab. Click Review changes. Leave a comment, check Approve , and then Submit review.


2 Answers

The formal support for GitHub (or BitBucket for that matter) pull request review is still pending (issue IDEA-85079, opened in 2012). It will be implemented in the 2020.2 release (see here).

Since 2016, it has support for GitHub PR in 2018.3, as commented here:

This is mostly read-only mode for now - one could create a local branch from a PR or open it on GitHub to comment/close it - but this is only the first step.

In future releases we plan to add additional functionality - ability to assign PRs IDEA-146659, merge/close them directly from IDE, comment on the PR and specific lines of code - IDEA-64794.

But: (Sept. 2019)

It's not at all obvious how to open the PR page. I had to look up the release notes to discover it's a double click. Discoverability of the PR tab is also poor; it isn't visible by default and there's no way to reach it from the version control tab, which is where I looked first.

Jan. 2020: Dan Oak mentions in the comments that:

CodeStream provides a tool to integrate GitHub PRs into IDEA.
See Pull Request Integrations:

CodeStream can display merged pull request comments in your editor as annotations on the current version of your


2016:

That leaves you with a manual process, fetching a PR, and comparing the branches:

git fetch origin pull/1234/head:pr-1234 

For BitBucket:

git fetch origin refs/pull-requests/1234/from:pr-1234 

(See also "How to fetch Pull Requests in BitBucket")

Then you can compare branches in IntelliJ.

like image 30
VonC Avatar answered Sep 28 '22 02:09

VonC


Most up-to-date information (March 2021)

Now, IntelliJ 2020.2 fully supports reviewing Pull Requests.

Preview of the feature

Accessing the feature

You can either navigate to: Main menu > VCS > Git > View Pull Requests.

Access from top-menu

Or it might be in your left "side-menu" (here the third option from the top):

Access from side-menu

Further information

It seems to be mostly an integration for GitHub (source):

Now the entire GitHub pull request workflow can be done directly from IntelliJ IDEA. It’s possible to browse, assign, manage, and even merge pull requests, view the timeline and inline comments, submit comments and reviews, and accept changes.

A more in-depth description of all the VCS-related features introduced can be found here:

Full GitHub Pull Requests support

We are excited to announce that IntelliJ IDEA 2020.2 will come with full support for GitHub Pull Requests!

We introduced initial support for GitHub Pull Requests with v2018.3, and we’ve been enhancing this functionality ever since. Previously, the IDE had some useful features, such as the GitHub tool window with a list of all pull requests associated with the repository, the Timeline view for a pull request, which opens in the editor, and the ability to view comments in diffs and create comments of your own. But those features were mostly for viewing pull requests and not for interacting with them.

With the upcoming IntelliJ IDEA 2020.2, you’ll be able to browse, assign, manage, and even merge pull requests, view the timeline and in-line comments, submit comments and reviews, and accept changes.

You no longer need to switch between the browser and your IDE. The entire Pull Request workflow can now be completed from within IntelliJ IDEA!

More previews

And two more sneak-peaks for the Review and Merge:

Preview #2

Preview #3


Creating PRs

Moreover, as of 2021.1, you can create Pull Requests, too:

creating a PR

like image 170
payne Avatar answered Sep 28 '22 03:09

payne