如何在 IntelliJ IDEA 中审查拉取请求?
How to review a pull request in IntelliJ IDEA?
我们正在使用 git、Bitbucket 和 IntelliJ IDEA。项目主要写在Java和Groovy.
是否有直接从 IntelliJ 审查拉取请求的好方法?
GitHub(或 BitBucket 就此而言)的正式支持拉取请求审查仍在进行中 (issue IDEA-85079
, opened in 2012). It will be implemented in the 2020.2 release (see here)。
自 2016 年以来,它有 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.
但是:(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.
一月。 2020 年:Dan Oak mentions 那:
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:
剩下 manual process,获取 PR,然后比较分支:
git fetch origin pull/1234/head:pr-1234
For BitBucket:
git fetch origin refs/pull-requests/1234/from:pr-1234
我发现在 .git/config 中的 [remote "origin"] 部分下附加 fetch = +refs/pull/*/head:refs/remotes/origin/pr/*
更容易,所以它看起来像这样:
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = xxxxxxxxxxxxxxx.git
fetch = +refs/pull/*/head:refs/remotes/origin/pr/*
然后 git fetch origin
获取所有拉取请求。我认为这也适用于 BitBucket,尽管我还没有测试过。
要查看 Pull 请求和更改,请在 Intellij 中使用以下步骤:
- 转到版本控制。
- 点击日志。将有一个所有提交的列表。
- Select 一个特定的提交。
- 在右侧window,您将获得本次提交的变更列表。
- Select 显示父更改。
- 单击显示更改的文件,然后您将能够看到所有代码更改。
大多数 up-to-date 信息(2021 年 3 月)
现在,IntelliJ 2020.2 fully supports reviewing Pull Requests.
访问功能
您可以导航至:主菜单 > VCS > Git > 查看拉取请求.
或者它可能在您的左侧“side-menu”(这里是从顶部数第三个选项):
更多信息
它似乎主要是 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.
可以找到对所介绍的所有 VCS-related 功能的更多 in-depth 描述 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!
更多预览
还有两个 sneak-peaks 用于审查和合并:
创建 PR
此外,as of 2021.1,您也可以创建 Pull Requests:
我们正在使用 git、Bitbucket 和 IntelliJ IDEA。项目主要写在Java和Groovy.
是否有直接从 IntelliJ 审查拉取请求的好方法?
GitHub(或 BitBucket 就此而言)的正式支持拉取请求审查仍在进行中 (issue IDEA-85079
, opened in 2012). It will be implemented in the 2020.2 release (see here)。
自 2016 年以来,它有 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.
但是:(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.
一月。 2020 年:Dan Oak mentions
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:
剩下 manual process,获取 PR,然后比较分支:
git fetch origin pull/1234/head:pr-1234
For BitBucket:
git fetch origin refs/pull-requests/1234/from:pr-1234
我发现在 .git/config 中的 [remote "origin"] 部分下附加 fetch = +refs/pull/*/head:refs/remotes/origin/pr/*
更容易,所以它看起来像这样:
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = xxxxxxxxxxxxxxx.git
fetch = +refs/pull/*/head:refs/remotes/origin/pr/*
然后 git fetch origin
获取所有拉取请求。我认为这也适用于 BitBucket,尽管我还没有测试过。
要查看 Pull 请求和更改,请在 Intellij 中使用以下步骤:
- 转到版本控制。
- 点击日志。将有一个所有提交的列表。
- Select 一个特定的提交。
- 在右侧window,您将获得本次提交的变更列表。
- Select 显示父更改。
- 单击显示更改的文件,然后您将能够看到所有代码更改。
大多数 up-to-date 信息(2021 年 3 月)
现在,IntelliJ 2020.2 fully supports reviewing Pull Requests.
访问功能
您可以导航至:主菜单 > VCS > Git > 查看拉取请求.
或者它可能在您的左侧“side-menu”(这里是从顶部数第三个选项):
更多信息
它似乎主要是 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.
可以找到对所介绍的所有 VCS-related 功能的更多 in-depth 描述 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!
更多预览
还有两个 sneak-peaks 用于审查和合并:
创建 PR
此外,as of 2021.1,您也可以创建 Pull Requests: