Using GitHub Copilot code review
Learn how to request a code review from GitHub Copilot.
Tool navigation
In this article
- About Copilot code review
- Requesting a review from Copilot
- Working with suggested changes provided by Copilot
- Providing feedback on Copilot's reviews
- Requesting a re-review from Copilot
- Enabling automatic reviews
- Customizing Copilot's reviews with custom instructions
- Customizing Copilot's reviews with coding guidelines
- Working with suggested changes provided by Copilot
- Providing feedback on Copilot's reviews
- Customizing Copilot's reviews with custom instructions
- Customizing Copilot's reviews with coding guidelines
About Copilot code review
GitHub Copilot can review your code and provide feedback. Where possible, Copilot's feedback includes suggested changes which you can apply with a couple of clicks.
Copilot code review in Visual Studio Code supports two types of review:
- Review selection: Highlight code and ask for an initial review
- Review changes: Request a deeper review of all your changes
The current functionality and availability of the two types of review is summarized in the following table:
Review selection | Review changes | |
---|---|---|
Available in | Visual Studio Code | Visual Studio Code and the GitHub website |
Premium/standard feature | Standard feature available to all Copilot subscribers | Premium feature. Available with the Copilot Pro, Copilot Pro+, Copilot Business, and Copilot Enterprise plans. Per-person monthly quota applies. |
Description | Initial review of a highlighted section of code with feedback and suggestions | Deeper review of all changes |
Supported languages | All | All |
Custom instructions support | No | Yes, seeCustomizing Copilot's reviews with custom instructions |
Custom coding guidelines support | No | Yes, seeCustomizing Copilot's reviews with coding guidelines |
Code review monthly quota
Thereview changes type of Copilot code review is a premium feature with a per-person monthly quota.
When you assign Copilot as a reviewer for a pull request, one premium request is deducted from your monthly quota each time Copilot posts comments to the pull request. SeeUnderstanding and managing requests in Copilot.
If a repository is configured to automatically request a code review from Copilot for all new pull requests, the premium request usage is applied to the quota of the pull request author. If a pull request is created by GitHub Actions or by a bot, the usage will apply to the user who triggered the workflow (if identifiable), or to a designated billing owner.
When you reach your monthly quota you will not be able to get a code review from Copilot until your quota resets—unless you upgrade your Copilot plan or enable additional premium requests.
Language support
Copilot code review supports all languages.
Two types of Copilot code review are available:
- Review selection: Highlight code and ask for an initial review(only available in VS Code)
- Review changes: Request a deeper review of all your changes(available in VS Code and the GitHub website)
This version of the article relates to Copilot code review on the GitHub website. To see information about the review selection type of Copilot code review, click the "Visual Studio Code" tool switcher at the top of the page.
Availability
GitHub Copilot code review is available with the Copilot Pro, Copilot Pro+, Copilot Business, and Copilot Enterprise plans.
If you receive Copilot from an organization, then to be able to request a review from Copilot,Copilot in GitHub.com must be enabled in the Copilot policy settings for the organization. SeeManaging policies and features for Copilot in your organization.
Code review monthly quota
Thereview changes type of Copilot code review is a premium feature with a per-person monthly quota.
When you assign Copilot as a reviewer for a pull request, one premium request is deducted from your monthly quota each time Copilot posts comments to the pull request. SeeUnderstanding and managing requests in Copilot.
If a repository is configured to automatically request a code review from Copilot for all new pull requests, the premium request usage is applied to the quota of the pull request author. If a pull request is created by GitHub Actions or by a bot, the usage will apply to the user who triggered the workflow (if identifiable), or to a designated billing owner.
When you reach your monthly quota you will not be able to get a code review from Copilot until your quota resets—unless you upgrade your Copilot plan or enable additional premium requests.
Language support
Copilot code review supports all languages.
Availability
GitHub Copilot code review is available with the Copilot Pro, Copilot Pro+, Copilot Business, and Copilot Enterprise plans.
If you receive Copilot from an organization, then to be able to request a review from Copilot,Copilot in GitHub.com must be enabled in the Copilot policy settings for the organization. SeeManaging policies and features for Copilot in your organization.
Code review monthly quota
Copilot code review is a premium feature with a per-person monthly quota.
When you assign Copilot as a reviewer for a pull request, one premium request is deducted from your monthly quota each time Copilot posts comments to the pull request. SeeUnderstanding and managing requests in Copilot.
If a repository is configured to automatically request a code review from Copilot for all new pull requests, the premium request usage is applied to the quota of the pull request author. If a pull request is created by GitHub Actions or by a bot, the usage will apply to the user who triggered the workflow (if identifiable), or to a designated billing owner.
When you reach your monthly quota you will not be able to get a code review from Copilot until your quota resets—unless you upgrade your Copilot plan or enable additional premium requests.
Language support
Copilot code review supports all languages.
Availability
GitHub Copilot code review is available with the Copilot Pro, Copilot Pro+, Copilot Business, and Copilot Enterprise plans.
Code review monthly quota
Copilot code review is a premium feature with a per-person monthly quota.
When you assign Copilot as a reviewer for a pull request, one premium request is deducted from your monthly quota each time Copilot posts comments to the pull request. SeeUnderstanding and managing requests in Copilot.
If a repository is configured to automatically request a code review from Copilot for all new pull requests, the premium request usage is applied to the quota of the pull request author. If a pull request is created by GitHub Actions or by a bot, the usage will apply to the user who triggered the workflow (if identifiable), or to a designated billing owner.
When you reach your monthly quota you will not be able to get a code review from Copilot until your quota resets—unless you upgrade your Copilot plan or enable additional premium requests.
Language support
Copilot code review supports all languages.
Validating Copilot code reviews
Warning
Copilot isn't guaranteed to spot all problems or issues in a pull request, and sometimes it will make mistakes. Always validate Copilot's feedback carefully, and supplement Copilot's feedback with a human review.
For more information, seeResponsible use of GitHub Copilot code review.
Requesting a review from Copilot
These instructions explain how to use Copilot code review in the GitHub website. To see instructions for other popular coding environments, use the tool switcher at the top of the page.
On GitHub.com, create a pull request or navigate to an existing pull request.
Open theReviewers menu, then selectCopilot.
Wait for Copilot to review your pull request. This usually takes less than 30 seconds.
Scroll down and read through Copilot's comments.
Copilot always leaves a "Comment" review, not an "Approve" review or a "Request changes" review. This means that Copilot's reviews do not count toward required approvals for the pull request, and Copilot's reviews will not block merging changes. For more details, seeApproving a pull request with required reviews.
Copilot's review comments behave like review comments from humans. You can add reactions to them, comment on them, resolve them and hide them.
Any comments you add to Copilot's review comments will be visible to humans, but they won't be visible to Copilot, and Copilot won't reply.
Working with suggested changes provided by Copilot
Where possible, Copilot's feedback includes suggested changes which you can apply with a couple of clicks.
If you're happy with the changes, you can accept a single suggestion from Copilot and commit it, or accept a group of suggestions together in a single commit. For more information, seeIncorporating feedback in your pull request.
Providing feedback on Copilot's reviews
You can provide feedback on Copilot's comments directly within each comment. We use this information to improve the product and the quality of Copilot's suggestions.
On a pull request review comment from Copilot, click the thumbs up (👍) or thumbs down (👎) button.
If you click the thumbs down button, you're asked to provide additional information. You can, optionally, pick the reason for your negative feedback and leave a comment before clickingSubmit feedback.
Requesting a re-review from Copilot
When you push changes to a pull request that Copilot has reviewed, it won't automatically re-review your changes.
To request a re-review from Copilot, click the button next to Copilot's name in theReviewers menu. For more information, seeRequesting a pull request review.
Note
When re-reviewing a pull request, Copilot may repeat the same comments again, even if they have been dismissed with the "Resolve conversation" button or downvoted with the thumbs down (👎) button.
Enabling automatic reviews
By default, you manually request a review from Copilot on each pull request, in the same way you would request a review from a human. However, you can set up Copilot to automatically review all pull requests. SeeConfiguring automatic code review by Copilot.
Customizing Copilot's reviews with custom instructions
Note
Custom instructions for Copilot code review are in public preview and are subject to change.
During the public preview, if you're using a Copilot Business or Copilot Enterprise plan, the organization or enterprise that provides your plan must have theOpt in to preview features setting enabled. SeeManaging policies and features for Copilot in your organization orManaging policies and features for Copilot in your enterprise
You can customize Copilot code review by adding a.github/copilot-instructions.md
file in your repository containing information that you want Copilot to consider when reviewing code. This is the samecopilot-instructions.md
used by Copilot Chat. SeeAdding repository custom instructions for GitHub Copilot.
Example
This example of a.github/copilot-instructions.md
file contains three instructions that will be applied to all Copilot code reviews in the repository.
When performing a code review, respond in Spanish.When performing a code review, follow our internal security checklist.When performing a code review, focus on readability and avoid nested ternary operators.
Customizing Copilot's reviews with coding guidelines
Note
The custom coding guidelines feature is only available with the Copilot Enterprise plan, and is currently limited to selected customers.
This feature will be deprecated in favor of using Copilot custom instructions to customize Copilot code review.
When using Copilot code review to review changes in Visual Studio Code or the GitHub website, you can customize Copilot's review with custom coding guidelines written in natural language. Copilot will give feedback based on your coding guidelines when it reviews your code. For more information, seeConfiguring coding guidelines for GitHub Copilot code review.
Comments generated based on a coding guideline will include a message, highlighting their source.
These instructions explain how to use Copilot code review in Visual Studio Code. To see instructions for other popular coding environments, use the tool switcher at the top of the page.
Note
Copilot code review is only available in Visual Studio Code with version 0.22 or later of the GitHub Copilot Chat extension.
Reviewing a selection of code
You can request an initial review of a highlighted selection of code in Visual Studio Code.
In Visual Studio Code, select the code you want to review.
Open the VS Code Command Palette
- For Mac:
- Use:Shift+Command+P
- For Windows or Linux:
- UseCtrl+Shift+P
- For Mac:
In the command palette, search for and selectGitHub Copilot: Review and Comment.
Wait for Copilot to review your changes. This usually takes less than 30 seconds.
If Copilot has any comments, they will be shown inline in your file, and in theProblems tab.
Reviewing changes
You can request a review for your staged or unstaged changes in Visual Studio Code.
In VS Code, switch to theSource Control tab.
To request a review on your unstaged changes, hover overChanges in the sidebar, and then click theCopilot code review - Changes button.
To request a review on your staged changes, hover overStaged Changes in the sidebar, and then click theCopilot code review - Staged Changes button.
Wait for Copilot to review your changes. This usually takes less than 30 seconds.
If Copilot has any comments, they will be shown inline in your file(s), and in theProblems tab.
Working with suggested changes provided by Copilot
Where possible, Copilot's feedback includes suggested changes which you can apply with a single click.
If you're happy with the change, you can accept a suggestion from Copilot by clicking theApply and Go To Next button. Any changes you apply will not be automatically committed.
If you don't want to apply Copilot's suggested change, click theDiscard and Go to Next button.
Providing feedback on Copilot's reviews
You can provide feedback on Copilot's comments directly within each comment. We use this information to improve the product and the quality of Copilot's suggestions.
To provide feedback, hover over the comment and click the thumbs up or thumbs down button.
Customizing Copilot's reviews with custom instructions
Note
Custom instructions for Copilot code review are in public preview and are subject to change.
During the public preview, if you're using a Copilot Business or Copilot Enterprise plan, the organization or enterprise that provides your plan must have theOpt in to preview features setting enabled. SeeManaging policies and features for Copilot in your organization orManaging policies and features for Copilot in your enterprise
You can customize Copilot code review by adding a.github/copilot-instructions.md
file in your repository containing information that you want Copilot to consider when reviewing code. This is the samecopilot-instructions.md
used by Copilot Chat. SeeAdding repository custom instructions for GitHub Copilot.
Example
This example of a.github/copilot-instructions.md
file contains three instructions that will be applied to all Copilot code reviews in the repository.
When performing a code review, respond in Spanish.When performing a code review, follow our internal security checklist.When performing a code review, focus on readability and avoid nested ternary operators.
Customizing Copilot's reviews with coding guidelines
Note
The custom coding guidelines feature is only available with the Copilot Enterprise plan, and is currently limited to selected customers.
This feature will be deprecated in favor of using Copilot custom instructions to customize Copilot code review.
When using Copilot code review to review changes in Visual Studio Code or the GitHub website, you can customize Copilot's review with custom coding guidelines written in natural language. Copilot will give feedback based on your coding guidelines when it reviews your code. For more information, seeConfiguring coding guidelines for GitHub Copilot code review.
Comments generated based on a coding guideline will include a message, highlighting their source.
These instructions explain how to use Copilot code review in Visual Studio. To see instructions for other popular coding environments, use the tool switcher at the top of the page.
To use Copilot code review, you must use Visual Studio version 17.14 or later. See theVisual Studio downloads page.
In the Git Changes window, clickReview changes with Copilot.This button appears as a comment icon with a sparkle.
Copilot will begin reviewing your changes. After a few moments, a link showing the number of code review comments appears in the Git Changes window.
Click the link to view and navigate the comments. If no issues are found, you’ll see the message:Copilot did not comment on any files.
Copilot displays comments in your code with a summary of each potential issue. You can:
- Review and make changes based on the suggestions.
- Dismiss a comment using the downward arrow in the top-right corner of the comment box.
To remove all review comments, click next to the code review link in the Git Changes window.
For more information on enabling and configuring Copilot code review in Visual Studio, seeReview local changes with Copilot Chat in the Visual Studio documentation.
These instructions explain how to use Copilot code review in GitHub Mobile. To see instructions for other popular coding environments, use the tool switcher at the top of the page.
- In GitHub Mobile, open a pull request.
- Scroll down to theReviews section and expand it.
- ClickRequest Reviews.
- Add Copilot as a reviewer, then clickDone.
Copilot will review the changes and provide feedback.