Note
- GitHub Copilot code review is in public preview and subject to change.
- To participate in the public preview, an administrator of your organization must opt in to the use of previews of Copilot features. See Managing policies for Copilot in your organization.
- Some functionality is available to all enabled Copilot subscribers, but other functionality is only available to a limited number of users. To join the waitlist for additional functionality, see Join the Copilot code review waitlist.
- The GitHub Pre-release License Terms apply to your use of this product.
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 supports two types of review:
- Review selection: Highlight code and ask for an initial review (Visual Studio Code only)
- Review changes: Request a deeper review of all your changes (GitHub website and Visual Studio Code)
The current functionality and availability of the two types of review is summarized in the following table:
Feature | Review selection | Review changes |
---|---|---|
Environment | Visual Studio Code | Visual Studio Code and the GitHub website |
Description | Initial review of a highlighted section of code with feedback and suggestions | Deeper review of all changes |
Language support | All | C#, Go, Java, JavaScript, Markdown, Python, Ruby, TypeScript |
Custom coding guidelines support | No | Yes, see Customizing Copilot's reviews with coding guidelines |
Availability | Public preview, available to all Copilot subscribers | Public preview with waitlist, see Join the Copilot code review waitlist |
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, see Responsible 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 Visual Studio Code, use the "Visual Studio Code" tool switcher at the top of the page.
Requesting a pull request review from Copilot
Note
Requesting a pull request review from Copilot is currently only available to a limited number of Copilot subscribers. To join the waitlist, see Join the Copilot code review waitlist.
-
On GitHub.com, create a pull request or navigate to an existing pull request.
-
Open the Reviewers menu, then select Copilot.
-
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 reviews for the pull request, and Copilot's reviews will not block merging changes. For more details, see Approving 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, see Incorporating feedback in your pull request.
If you want to validate Copilot's suggested changes (for example by running automated tests or your linter), or if you want to make modifications before committing the suggested changes, click the Open in Workspace button. For more information, see Using Copilot to help you work on a 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 clicking Submit 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 the Reviewers menu. For more information, see Requesting 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 from Copilot
By default, you will have to manually request a review from Copilot on each pull request.
You can enable automatic reviews from Copilot on all pull requests using rulesets configured at the repository level or organization level. For more information, see About rulesets.
To turn this on, enable the Request pull request review from Copilot branch rule, nested under Require a pull request before merging.
Customizing Copilot's reviews with coding guidelines
Note
Custom coding guidelines are currently only available to selected participants in the public preview of Copilot code review. Being accepted from the waitlist does not provide immediate access. In addition, custom coding guidelines are only available as part of a subscription to GitHub Copilot Enterprise.
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, see "Configuring 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 the GitHub website, use the "Web browser" 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:
- Use Ctrl+Shift+P
- For Mac:
-
In the command palette, search for and select GitHub 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 the Problems tab.
Reviewing changes
Note
Reviewing changes is currently only available to a limited number of Copilot subscribers. To join the waitlist, see Join the Copilot code review waitlist.
You can request a review for your staged or unstaged changes in Visual Studio Code.
-
In VS Code, switch to the Source Control tab.
-
To request a review on your unstaged changes, hover over Changes in the sidebar, and then click the Copilot code review - Changes button.
-
To request a review on your staged changes, hover over Staged Changes in the sidebar, and then click the Copilot 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 the Problems 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 the Apply 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 the Discard 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 coding guidelines
Note
Custom coding guidelines are currently only available to selected participants in the public preview of Copilot code review. Being accepted from the waitlist does not provide immediate access. In addition, custom coding guidelines are only available as part of a subscription to GitHub Copilot Enterprise.
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, see "Configuring coding guidelines for GitHub Copilot code review."
Comments generated based on a coding guideline will include a message, highlighting their source.