Signed-off-by: Meredith Lancaster <malancas@users.noreply.github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Anne-Marie <102995847+am-stead@users.noreply.github.com> Co-authored-by: Felicity Chapman <felicitymay@github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Laura Coursen <lecoursen@github.com> Co-authored-by: AlonaHlobina <54394529+AlonaHlobina@users.noreply.github.com> Co-authored-by: Isaac Brown <101839405+isaacmbrown@users.noreply.github.com> Co-authored-by: Jules <19994093+jules-p@users.noreply.github.com> Co-authored-by: Siara <108543037+SiaraMist@users.noreply.github.com> Co-authored-by: Kelly Arwine <kellyarwine@github.com> Co-authored-by: mc <42146119+mchammer01@users.noreply.github.com> Co-authored-by: Jon Janego <jonjanego@github.com> Co-authored-by: Jules Porter <jules-p@users.noreply.github.com> Co-authored-by: hubwriter <hubwriter@github.com> Co-authored-by: Laurenzo <lsto@github.com> Co-authored-by: Sam Browning <106113886+sabrowning1@users.noreply.github.com> Co-authored-by: Vanessa <vgrl@github.com> Co-authored-by: Melanie Yarbrough <11952755+myarb@users.noreply.github.com> Co-authored-by: Claire W <78226508+crwaters16@users.noreply.github.com> Co-authored-by: Felix Guntrip <guntrip@github.com> Co-authored-by: James Fletcher <42464962+jf205@users.noreply.github.com> Co-authored-by: Joe Clark <31087804+jc-clark@users.noreply.github.com> Co-authored-by: Tim Rogers <timrogers@github.com> Co-authored-by: docs-bot <77750099+docs-bot@users.noreply.github.com> Co-authored-by: Guillaume Perrot <guperrot@github.com> Co-authored-by: Mark Tareshawty <tarebyte@github.com> Co-authored-by: Hirsch Singhal <1666363+hpsin@users.noreply.github.com> Co-authored-by: Emily Gould <4822039+emilyistoofunky@users.noreply.github.com> Co-authored-by: Sunbrye Ly <56200261+sunbrye@users.noreply.github.com> Co-authored-by: PJ Quirk <pjquirk@github.com> Co-authored-by: Steve Ward <steveward@github.com> Co-authored-by: Sarita Iyer <66540150+saritai@users.noreply.github.com> Co-authored-by: Kevin Heis <heiskr@users.noreply.github.com> Co-authored-by: SiaraMist <siaramist@github.com> Co-authored-by: Tomoko Tanaka <28242405+tallzeebaa@users.noreply.github.com> Co-authored-by: a1exmozz <187176404+a1exmozz@users.noreply.github.com> Co-authored-by: Meredith Lancaster <malancas@users.noreply.github.com> Co-authored-by: Sarah Schneider <sarahs@users.noreply.github.com> Co-authored-by: Andy Barnes <kurgol@github.com> Co-authored-by: Sheena Ganju <sheenyg@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Sydney Wilson <86739163+swilson15@users.noreply.github.com> Co-authored-by: Robert Sese <734194+rsese@users.noreply.github.com> Co-authored-by: Vimala Moger <166641453+VimalaMoger@users.noreply.github.com> Co-authored-by: Sharra-writes <sharra-writes@github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Jenni C <97056108+dihydroJenoxide@users.noreply.github.com> Co-authored-by: Greg Mondello <72952982+gmondello@users.noreply.github.com> Co-authored-by: Mia Arts <107727642+its-mia@users.noreply.github.com> Co-authored-by: sunbrye <sunbrye@github.com> Co-authored-by: Lorenz Vanthillo <lorenz.vanthillo@gmail.com> Co-authored-by: Eboni <32157169+EboniLM@users.noreply.github.com> Co-authored-by: Junko Suzuki <pnsk@github.com> Co-authored-by: Alex Nguyen <150945400+nguyenalex836@users.noreply.github.com> Co-authored-by: heiskr <1221423+heiskr@users.noreply.github.com> Co-authored-by: Patrick Knight <patrick-knight@github.com> Co-authored-by: T. Greg Doucette <58960990+LawDevNull@users.noreply.github.com> Co-authored-by: Evan Bonsignori <ebonsignori@github.com> Co-authored-by: Robert Justin Monzingo <robertjmonzingo@gmail.com> Co-authored-by: John Coleman <thenewcoke@gmail.com> Co-authored-by: Brendan Scott-Smith <117171930+bss-mc@users.noreply.github.com> Co-authored-by: Chad Bentz <1760475+felickz@users.noreply.github.com> Co-authored-by: Justin Alex <1155821+jusuchin85@users.noreply.github.com> Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: azenMatt <7584089+azenMatt@users.noreply.github.com> Co-authored-by: Felix Guntrip <stevecat@github.com> Co-authored-by: timrogers <116134+timrogers@users.noreply.github.com> Co-authored-by: John Clement <70238417+jclement136@users.noreply.github.com> Co-authored-by: vaindil <vaindil@github.com> Co-authored-by: Matthew Isabel <matthewisabel@github.com> Co-authored-by: Matthew Isabel <matthew.isabel@gmail.com>
6.0 KiB
title, shortTitle, intro, versions, topics
| title | shortTitle | intro | versions | topics | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Getting feedback on your code from GitHub Copilot | Getting feedback on your code | Learn how you can ask {% data variables.product.prodname_copilot %} to review your code changes and apply the suggested changes it creates. |
|
|
About coding collaboratively
When you're working with others on {% data variables.product.github %}, you typically make your changes in a branch or fork of the main project and then submit them as a pull request. A pull request shows the differences between the original code and your changes, and invites the repository maintainer to merge your code into the project.
Getting feedback on your pull request from others is an important part of the software development process. Pull request reviews improve the specific code you're working on, and also improves your coding and collaboration skills over time. Sometimes, especially when you're learning to code, you may not always have someone to ask for feedback. In those cases, you can get feedback and all its benefits from {% data variables.product.prodname_copilot %} instead.
A pull request is a collaborative place where you can show other people the changes you're proposing and get feedback. When you request a review from Copilot, you'll be learning the same process that you'll use use when working with development teams. The only difference is you'll also be requesting reviews from human colleagues alongside Copilot.
Note
{% data variables.copilot.copilot_code-review_short %} on the {% data variables.product.github %} website is a premium feature, available with the {% data variables.copilot.copilot_pro_short %}, {% data variables.copilot.copilot_pro_plus_short %}, {% data variables.copilot.copilot_business_short %}, and {% data variables.copilot.copilot_enterprise_short %} plans. For more information about how using {% data variables.copilot.copilot_code-review_short %} affects your quotas, see AUTOTITLE. If you're a student, you may be able to get {% data variables.copilot.copilot_pro_short %} for free, see AUTOTITLE.
1. Creating the practice repository
In this exercise, you’ll use a sample repository with existing code. The sample repository is new2code/grid-toy, a small HTML and JavaScript project that displays a grid of color-changing squares. This is a {% data variables.product.prodname_pages %} site and you can view the original version at https://new2code.github.io/grid-toy.
Get started by creating your own copy of the grid-toy repository.
- Navigate to the new repository page. Following this link will pre-select the template on the
new2codeaccount. - Under "Owner", select your user account.
- In the "Repository name" field, type "grid-toy".
- Click Create repository.
2. Making a change
Next, you’ll make a change to the JavaScript file.
-
In your new repository, click
script.jsin the file list. -
To edit the JavaScript file, at the top-right, click {% octicon "pencil" aria-label="Edit this file" %}.
-
On line 25, add the following code:
if (Math.random() < INVERT_PROBABILITY) { cell.classes.add("black"); }This change randomly sets some grid squares to black when the page loads. There's a deliberate error to trigger feedback from {% data variables.product.prodname_copilot %}: the correct property is actually
.classListand not.classes. {% data variables.product.prodname_copilot %} should help us fix this. -
To commit the change, at the top-right, click Commit changes...
-
In the "Commit message" field, enter something like "Randomly set squares on load".
-
Select Create a new branch for this commit and start a pull request.
-
Click Propose changes.
3. Creating a pull request and requesting a review
Now complete the pull request and request a review.
- Type a title and, optionally, a description for your pull request.
- Click Reviewers.
- If Copilot appears in the suggested list, click "Copilot".
- If not, start typing "Copilot", then click the result.
- Click Create pull request.
You’ll be taken to your new pull request.
4. Applying a suggested change
Within a few minutes, {% data variables.product.prodname_copilot %} will review your pull request, produce a summary, and create suggested changes for any problems found.
-
Wait for the review from {% data variables.product.prodname_copilot %} to appear.
-
One of these suggestions should correct the intentional error from earlier by changing
.classesto.classList. Below the suggested change, click Commit suggestion. -
Click Commit changes.
-
It's possible that {% data variables.product.prodname_copilot %} found other improvements and left additional comments. If you understand the changes suggested, you can apply these too.
5. Merging
Once you're happy with the changes, you can merge the pull request. This adds the changes from your branch to the repository’s default branch (main).
- At the bottom of the page, click Merge pull request.
- Optionally, update the commit message.
- Press Confirm merge.
Next steps
The project can be published using {% data variables.product.prodname_pages %}. Now you've made some changes, you could publish your version of the repository to see it in action. See AUTOTITLE.
