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