{"id":88621,"date":"2025-06-09T06:00:00","date_gmt":"2025-06-09T13:00:00","guid":{"rendered":"https:\/\/github.blog\/?p=88621"},"modified":"2025-06-06T12:04:48","modified_gmt":"2025-06-06T19:04:48","slug":"github-for-beginners-code-review-and-refactoring-with-github-copilot","status":"publish","type":"post","link":"https:\/\/github.blog\/ai-and-ml\/github-copilot\/github-for-beginners-code-review-and-refactoring-with-github-copilot\/","title":{"rendered":"GitHub for Beginners: Code review and refactoring with GitHub Copilot"},"content":{"rendered":"<!DOCTYPE html PUBLIC \"-\/\/W3C\/\/DTD HTML 4.0 Transitional\/\/EN\" \"http:\/\/www.w3.org\/TR\/REC-html40\/loose.dtd\">\n<html><body><p>Welcome to the next episode in our GitHub for Beginners series, where we&rsquo;re diving into the world of <a href=\"https:\/\/www.youtube.com\/watch?v=n0NlxUyA7FI&amp;list=PL0lo9MOBetEFcp4SCWinBdpml9B2U25-f&amp;index=6\">GitHub Copilot<\/a>. This is our eighth and final episode, and it&rsquo;s been quite a journey. We&rsquo;ve covered a lot of different topics showcasing the power of GitHub Copilot, and you can check out all our previous episodes on <a href=\"https:\/\/github.blog\/tag\/github-for-beginners\/\">our blog<\/a> or <a href=\"https:\/\/www.youtube.com\/playlist?list=PL0lo9MOBetEFcp4SCWinBdpml9B2U25-f\">as videos<\/a>.<\/p>\n\n\n\n<p>Today we&rsquo;re covering that important step of code review&mdash;getting a second pair of eyes on your code. This can help catch bugs, improve code quality, and ensure consistency. We&rsquo;ll also talk about refactoring code&mdash;restructuring existing code without changing its functionality. This can make things more efficient or more readable for those who need to understand it later (even if that&rsquo;s yourself).<\/p>\n\n\n\n<p>In any development project, maintaining a clean and efficient codebase is crucial to make future work easier. But in reality, things can quickly become messy as you&rsquo;re focused on making it work. That&rsquo;s where Copilot can come in handy. It doesn&rsquo;t just assist you in writing code, it also makes the review and refactoring process smoother and more efficient.<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n\n\t\t<div class=\"mod-vh position-relative\" style=\"height: 0; padding-bottom: calc((9 \/ 16)*100%);\">\n\t\t\t<iframe loading=\"lazy\" class=\"position-absolute top-0 left-0 width-full height-full\" src=\"https:\/\/www.youtube.com\/embed\/LsQGilvXAfE?version=3&amp;rel=1&amp;showsearch=0&amp;showinfo=1&amp;iv_load_policy=1&amp;fs=1&amp;hl=en-US&amp;autohide=2&amp;wmode=transparent\" title=\"YouTube video player\" allow=\"accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen=\"\" frameborder=\"0\"><\/iframe>\n\t\t<\/div>\n<\/div><\/figure>\n\n\n\n<aside data-color-mode=\"light\" data-dark-theme=\"dark\" data-light-theme=\"light_dimmed\" class=\"wp-block-group post-aside--large p-4 p-md-6 is-style-light-dimmed has-global-padding is-layout-constrained wp-block-group-is-layout-constrained is-style-light-dimmed--2\" style=\"border-top-width:4px\">\n<h3 class=\"wp-block-heading h5-mktg gh-aside-title is-typography-preset-h5\" id=\"h-for-the-demos-in-this-series-we-re-using-github-copilot-in-visual-studio-code\" style=\"margin-top:0\">For the demos in this series, we&rsquo;re using GitHub Copilot in Visual Studio Code<\/h3>\n\n\n\n<p>Copilot is available in other IDEs, but the available functionality may vary depending on your environment.<\/p>\n<\/aside>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"refactoring-code\">Refactoring code<\/h2>\n\n\n\n<p>Suppose that you have a function that is long and difficult to understand. Refactoring code can make it easier to understand and ensure pieces of it aren&rsquo;t too unwieldy to follow.<\/p>\n\n\n\n<p>To use GitHub Copilot to help you with this refactoring task, open up Copilot Chat and do the following:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Highlight the function you want to refactor in your code editor.<\/li>\n\n\n\n<li>In Copilot Chat, send the prompt <code>please provide refactoring suggestions<\/code>.<\/li>\n\n\n\n<li>Review the changes that Copilot suggests. It might break the code up into smaller pieces or optimize the logic for better performance. It might even update variable names to be aligned with your naming conventions.<\/li>\n\n\n\n<li>Once you&rsquo;re comfortable with the suggested changes, click the <strong>Apply in editor<\/strong> button to apply the changes and have Copilot automatically update the file.<\/li>\n<\/ol>\n\n\n\n<p>This works well for small changes, but there&rsquo;s no reason to stop there. This is just if you want to focus Copilot&rsquo;s attention on a specific area of your code. You can also have it look across entire files or your project. For example, take a look at <a href=\"https:\/\/github.com\/github-samples\/planventure\/blob\/client-complete\/planventure-client\/src\/pages\/Dashboard.jsx\">this dashboard component<\/a>. Let&rsquo;s say you want to improve it.<\/p>\n\n\n\n<p>To do so, open up the component in your editor and send Copilot Chat the following prompt:<\/p>\n\n\n<div class=\"wp-block-code-wrapper\">\n<pre class=\"wp-block-code language-plaintext\"><code>How can I improve this code?<\/code><\/pre>\n<clipboard-copy aria-label=\"Copy\" class=\"code-copy-btn\" data-copy-feedback=\"Copied!\" value=\"How can I improve this code?\" tabindex=\"0\" role=\"button\"><svg aria-hidden=\"true\" height=\"16\" viewbox=\"0 0 16 16\" version=\"1.1\" width=\"16\" class=\"octicon octicon-copy js-clipboard-copy-icon\"><path d=\"M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25Z\"><\/path><path d=\"M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z\"><\/path><\/svg><svg aria-hidden=\"true\" height=\"16\" viewbox=\"0 0 16 16\" version=\"1.1\" width=\"16\" class=\"octicon octicon-check js-clipboard-check-icon\"><path d=\"M13.78 4.22a.75.75 0 0 1 0 1.06l-7.25 7.25a.75.75 0 0 1-1.06 0L2.22 9.28a.751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018L6 10.94l6.72-6.72a.75.75 0 0 1 1.06 0Z\"><\/path><\/svg><\/clipboard-copy><\/div>\n\n\n<p>Copilot will then give several suggestions on ways the code can be improved. You can review these suggestions and even ask Copilot to explain each step in greater detail. When you&rsquo;re finished, click the <strong>Apply in editor<\/strong> button to have Copilot make the necessary changes.<\/p>\n\n\n\n<figure class=\"wp-block-video\"><video height=\"928\" style=\"aspect-ratio: 1656 \/ 928;\" width=\"1656\" controls poster=\"https:\/\/github.blog\/wp-content\/uploads\/2025\/06\/Screenshot-2025-06-05-at-5.36.58&#8239;PM.png\" src=\"https:\/\/github.blog\/wp-content\/uploads\/2025\/06\/ep8-refactor-suggestions.mp4\"><\/video><\/figure>\n\n\n\n<p>To see this in action, check out the video version of this episode. Just remember that since Copilot is a generative AI tool, the suggestions you see might not match those in the video exactly.<\/p>\n\n\n\n<p>You can take this a step further by asking specific and direct questions. For example, you might want to make the data fetching logic reusable across components by creating a custom hook and centralizing the logic. To do this, create a new chat conversation and ask it the following:<\/p>\n\n\n<div class=\"wp-block-code-wrapper\">\n<pre class=\"wp-block-code language-plaintext\"><code>How can I extract the data fetching logic into a custom hook?<\/code><\/pre>\n<clipboard-copy aria-label=\"Copy\" class=\"code-copy-btn\" data-copy-feedback=\"Copied!\" value=\"How can I extract the data fetching logic into a custom hook?\" tabindex=\"0\" role=\"button\"><svg aria-hidden=\"true\" height=\"16\" viewbox=\"0 0 16 16\" version=\"1.1\" width=\"16\" class=\"octicon octicon-copy js-clipboard-copy-icon\"><path d=\"M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25Z\"><\/path><path d=\"M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z\"><\/path><\/svg><svg aria-hidden=\"true\" height=\"16\" viewbox=\"0 0 16 16\" version=\"1.1\" width=\"16\" class=\"octicon octicon-check js-clipboard-check-icon\"><path d=\"M13.78 4.22a.75.75 0 0 1 0 1.06l-7.25 7.25a.75.75 0 0 1-1.06 0L2.22 9.28a.751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018L6 10.94l6.72-6.72a.75.75 0 0 1 1.06 0Z\"><\/path><\/svg><\/clipboard-copy><\/div>\n\n\n<p>Copilot generates refactored code that allows you to extract the logic out of the Dashboard component into a new hook directory that you can use in multiple components in the app. This makes it much more reusable! To follow through on this:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Save the changes in a new file by selecting <strong>&hellip;<\/strong> &gt; <strong>Insert into New File<\/strong>.<\/li>\n\n\n\n<li>Import the hook into the dashboard file.<\/li>\n\n\n\n<li>Remove the old code.<\/li>\n<\/ol>\n\n\n\n<p>Now what if you wanted Copilot to take a look and make sure you didn&rsquo;t have a bunch of redundant code in your file? Just ask it.<\/p>\n\n\n<div class=\"wp-block-code-wrapper\">\n<pre class=\"wp-block-code language-plaintext\"><code>Is there any redundant code in this file?<\/code><\/pre>\n<clipboard-copy aria-label=\"Copy\" class=\"code-copy-btn\" data-copy-feedback=\"Copied!\" value=\"Is there any redundant code in this file?\" tabindex=\"0\" role=\"button\"><svg aria-hidden=\"true\" height=\"16\" viewbox=\"0 0 16 16\" version=\"1.1\" width=\"16\" class=\"octicon octicon-copy js-clipboard-copy-icon\"><path d=\"M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25Z\"><\/path><path d=\"M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z\"><\/path><\/svg><svg aria-hidden=\"true\" height=\"16\" viewbox=\"0 0 16 16\" version=\"1.1\" width=\"16\" class=\"octicon octicon-check js-clipboard-check-icon\"><path d=\"M13.78 4.22a.75.75 0 0 1 0 1.06l-7.25 7.25a.75.75 0 0 1-1.06 0L2.22 9.28a.751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018L6 10.94l6.72-6.72a.75.75 0 0 1 1.06 0Z\"><\/path><\/svg><\/clipboard-copy><\/div>\n\n\n<p>Copilot scans your code and identifies any redundancies that can be corrected. After reviewing the suggestions, go ahead and apply them to tighten up your code and make it a bit cleaner.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" decoding=\"async\" loading=\"lazy\" height=\"573\" width=\"1024\" src=\"https:\/\/github.blog\/wp-content\/uploads\/2025\/06\/copilot_refactor_help.png?resize=1024%2C573\" alt=\"A slide explaining that Copilot can help with performance improvement suggestions, how to make functions more modular, adding comments for readability, upgrading syntax, and much more!\" class=\"wp-image-88628\" srcset=\"https:\/\/github.blog\/wp-content\/uploads\/2025\/06\/copilot_refactor_help.png?w=1657 1657w, https:\/\/github.blog\/wp-content\/uploads\/2025\/06\/copilot_refactor_help.png?w=300 300w, https:\/\/github.blog\/wp-content\/uploads\/2025\/06\/copilot_refactor_help.png?w=768 768w, https:\/\/github.blog\/wp-content\/uploads\/2025\/06\/copilot_refactor_help.png?w=1024 1024w, https:\/\/github.blog\/wp-content\/uploads\/2025\/06\/copilot_refactor_help.png?w=1536 1536w\" sizes=\"auto, (max-width: 1000px) 100vw, 1000px\" \/><\/figure>\n\n\n\n<p>Reviewing and refactoring your code with GitHub Copilot is a great way to do an initial overview of the work you&rsquo;ve done. You can also ask Copilot for performance improvement suggestions, how to make functions more modular, have it add comments, or upgrade syntax to be more modern. If you can think of a question, ask Copilot and see what it can do.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"code-reviews-in-github-com\">Code reviews in github.com<\/h2>\n\n\n\n<p>If you have the proper access, you can also get GitHub Copilot code reviews directly on github.com to make the process even more seamless. First, open up a pull request. Under the &ldquo;Reviewers&rdquo; section in the top-right corner, you&rsquo;ll notice <strong>Copilot<\/strong> listed as a possible reviewer. Click <strong>Request<\/strong> to have Copilot review your code.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" decoding=\"async\" loading=\"lazy\" height=\"573\" width=\"1024\" src=\"https:\/\/github.blog\/wp-content\/uploads\/2025\/06\/code_review.png?resize=1024%2C573\" alt=\"A screenshot shoring where to request a review from Copilot, under the 'reviewers' list on the right.\" class=\"wp-image-88629\" srcset=\"https:\/\/github.blog\/wp-content\/uploads\/2025\/06\/code_review.png?w=1657 1657w, https:\/\/github.blog\/wp-content\/uploads\/2025\/06\/code_review.png?w=300 300w, https:\/\/github.blog\/wp-content\/uploads\/2025\/06\/code_review.png?w=768 768w, https:\/\/github.blog\/wp-content\/uploads\/2025\/06\/code_review.png?w=1024 1024w, https:\/\/github.blog\/wp-content\/uploads\/2025\/06\/code_review.png?w=1536 1536w\" sizes=\"auto, (max-width: 1000px) 100vw, 1000px\" \/><\/figure>\n\n\n\n<p>Once Copilot finishes the review, scroll down on the pull request to see any suggestions that it makes. It&rsquo;s important to note that Copilot always leaves a <strong>Comment<\/strong> review, and never an <strong>Approve<\/strong> or <strong>Request changes<\/strong> review. This means that Copilot&rsquo;s reviews will never be required nor block merges.<\/p>\n\n\n\n<p>To accept any of Copilot&rsquo;s suggestions, click <strong>Commit suggestion<\/strong> at the bottom of the specific suggestion you&rsquo;d like to integrate. This pulls up a context menu. Click <strong>Commit changes<\/strong> and GitHub will update your pull request with that change.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" decoding=\"async\" loading=\"lazy\" height=\"573\" width=\"1024\" src=\"https:\/\/github.blog\/wp-content\/uploads\/2025\/06\/commit_code_review.png?resize=1024%2C573\" alt=\"A screenshot showing the 'Commit changes' button in the drop down menu titled 'Commit suggestion.'\" class=\"wp-image-88631\" srcset=\"https:\/\/github.blog\/wp-content\/uploads\/2025\/06\/commit_code_review.png?w=1657 1657w, https:\/\/github.blog\/wp-content\/uploads\/2025\/06\/commit_code_review.png?w=300 300w, https:\/\/github.blog\/wp-content\/uploads\/2025\/06\/commit_code_review.png?w=768 768w, https:\/\/github.blog\/wp-content\/uploads\/2025\/06\/commit_code_review.png?w=1024 1024w, https:\/\/github.blog\/wp-content\/uploads\/2025\/06\/commit_code_review.png?w=1536 1536w\" sizes=\"auto, (max-width: 1000px) 100vw, 1000px\" \/><\/figure>\n\n\n\n<p>You can also batch several suggested changes by clicking the <strong>Add to batch<\/strong> button under individual suggestions so they are pulled into one change.<\/p>\n\n\n\n<p>After you&rsquo;ve integrated any suggestions and made any changes, you can request another review from Copilot by clicking the circular arrows in the &ldquo;Reviewers&rdquo; box next to Copilot&rsquo;s name.<\/p>\n\n\n\n<p>With Copilot code review, you can have Copilot perform a preliminary review of your code before asking your team for that final code review.&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"key-components-and-limitations\">Key components and limitations<\/h2>\n\n\n\n<p>The key components of using Copilot for code review and refactoring can be broken down into five areas:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Automated suggestions:<\/strong> Copilot suggests improvements and optimizations as you review your code.<\/li>\n\n\n\n<li><strong>Consistency checks:<\/strong> Copilot helps maintain coding standards by suggesting consistent naming conventions and structures for your functions.<\/li>\n\n\n\n<li><strong>Refactoring assistance:<\/strong> Copilot provides actionable refactoring suggestions, whether it&rsquo;s simplifying complex functions or reorganizing your codebase.<\/li>\n\n\n\n<li><strong>Error detection:<\/strong> Copilot can spot potential bugs or inefficiencies that you might have missed while building.<\/li>\n\n\n\n<li><strong>Comment support:<\/strong> Copilot helps generate clear comments in your code, making it easier to understand for others.<\/li>\n<\/ul>\n\n\n\n<p>While GitHub Copilot can do a lot, it&rsquo;s important to keep in mind that you are the pilot, and we call it Copilot for a reason. It&rsquo;s a powerful tool, but it does have some limitations. First and foremost, it relies on the context you provide, so unclear or poorly documented code might lead to less effective suggestions.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" decoding=\"async\" loading=\"lazy\" height=\"573\" width=\"1024\" src=\"https:\/\/github.blog\/wp-content\/uploads\/2025\/06\/copilot_can_do.png?resize=1024%2C573\" alt=\"A slide listing items Copilot can do: Assists with code review and refactoring; helps maintain clean, efficient, and consistent code; saves you time and reduces errors; and allows you to focus more on building.\" class=\"wp-image-88634\" srcset=\"https:\/\/github.blog\/wp-content\/uploads\/2025\/06\/copilot_can_do.png?w=1657 1657w, https:\/\/github.blog\/wp-content\/uploads\/2025\/06\/copilot_can_do.png?w=300 300w, https:\/\/github.blog\/wp-content\/uploads\/2025\/06\/copilot_can_do.png?w=768 768w, https:\/\/github.blog\/wp-content\/uploads\/2025\/06\/copilot_can_do.png?w=1024 1024w, https:\/\/github.blog\/wp-content\/uploads\/2025\/06\/copilot_can_do.png?w=1536 1536w\" sizes=\"auto, (max-width: 1000px) 100vw, 1000px\" \/><\/figure>\n\n\n\n<p>In addition, while Copilot can catch many issues, it&rsquo;s not a substitute for a thorough human review. Always double check the suggestions it provides to ensure they align with your project&rsquo;s goals and standards, as well as your organizational policies.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"your-next-steps\">Your next steps<\/h2>\n\n\n\n<p>GitHub Copilot is an invaluable assistant for code review and refactoring. It helps you maintain clean, efficient, and consistent code, saving you time and reducing errors. By integrating Copilot into your workflow, you can focus more on building great features and less on the nitty-gritty aspects of code maintenance.<\/p>\n\n\n\n<p>If you&rsquo;d like to dive a little deeper into using Copilot to help with code reviews and refactoring, here are some links to get you started:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/docs.github.com\/copilot\/copilot-chat-cookbook\/refactoring-code\/improving-code-readability-and-maintainability\">Improving code readability and maintainability<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/docs.github.com\/copilot\/using-github-copilot\/guides-on-using-github-copilot\/refactoring-code-with-github-copilot\">Refactoring code with GitHub Copilot<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/docs.github.com\/copilot\/copilot-chat-cookbook\/refactoring-code\/refactoring-for-performance-optimization\">Refactoring for performance optimization<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/docs.github.com\/copilot\/using-github-copilot\/code-review\/using-copilot-code-review\">Using GitHub Copilot code review<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/docs.github.com\/copilot\/using-github-copilot\/code-review\/configuring-coding-guidelines\">Configuring coding guidelines for GitHub Copilot code review<\/a><\/li>\n<\/ul>\n\n\n\n<p>Don&rsquo;t forget that you can <a href=\"https:\/\/gh.io\/gfb-copilot\">use GitHub Copilot for free<\/a>! If you have any questions, pop them in the <a href=\"https:\/\/github.com\/orgs\/community\/discussions\/152688\">GitHub Community thread<\/a>, and we&rsquo;ll be sure to respond. Thanks so much for joining us for this season of GitHub for Beginners! Don&rsquo;t forget to check out our previous episodes if you haven&rsquo;t already.<\/p>\n\n\n\n<p>Happy coding!<\/p>\n\n\n\n<div class=\"wp-block-group post-content-cta has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<p><strong>Need some help<\/strong> getting through a preliminary code review? Give <a href=\"https:\/\/github.com\/features\/copilot\">GitHub Copilot<\/a> a try!<\/p>\n<\/div>\n<\/body><\/html>\n","protected":false},"excerpt":{"rendered":"<p>Learn how to use GitHub Copilot to help review and polish your code.<\/p>\n","protected":false},"author":2041,"featured_media":82914,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_gh_post_show_toc":"yes","_gh_post_is_no_robots":"","_gh_post_is_featured":"yes","_gh_post_is_excluded":"","_gh_post_is_unlisted":"","_gh_post_related_link_1":"","_gh_post_related_link_2":"","_gh_post_related_link_3":"","_gh_post_sq_img":"https:\/\/github.blog\/wp-content\/uploads\/2024\/06\/Professortocat_v2.png","_gh_post_sq_img_id":"78333","_gh_post_cta_title":"","_gh_post_cta_text":"","_gh_post_cta_link":"","_gh_post_cta_button":"","_gh_post_recirc_hide":"","_gh_post_recirc_col_1":"","_gh_post_recirc_col_2":"","_gh_post_recirc_col_3":"","_gh_post_recirc_col_4":"","_featured_video":"","_gh_post_additional_query_params":"","_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false},"version":2},"_wpas_customize_per_network":false,"_links_to":"","_links_to_target":""},"categories":[3293,3295],"tags":[3412,2535,3286,3513],"coauthors":[2854],"class_list":["post-88621","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ai-and-ml","category-github-copilot","tag-code-review","tag-github-copilot","tag-github-for-beginners","tag-refactoring-code"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.5 (Yoast SEO v27.5) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>GitHub for Beginners: Code review and refactoring with GitHub Copilot - The GitHub Blog<\/title>\n<meta name=\"description\" content=\"Learn how to use GitHub Copilot to help review and polish your code.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/github.blog\/ai-and-ml\/github-copilot\/github-for-beginners-code-review-and-refactoring-with-github-copilot\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"GitHub for Beginners: Code review and refactoring with GitHub Copilot\" \/>\n<meta property=\"og:description\" content=\"Learn how to use GitHub Copilot to help review and polish your code.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/github.blog\/ai-and-ml\/github-copilot\/github-for-beginners-code-review-and-refactoring-with-github-copilot\/\" \/>\n<meta property=\"og:site_name\" content=\"The GitHub Blog\" \/>\n<meta property=\"article:published_time\" content=\"2025-06-09T13:00:00+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/github.blog\/wp-content\/uploads\/2025\/02\/418127171-3bd956ac-6856-4c72-8601-010f10058417.png?fit=2400%2C1260\" \/>\n\t<meta property=\"og:image:width\" content=\"2400\" \/>\n\t<meta property=\"og:image:height\" content=\"1260\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Kedasha Kerr\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Kedasha Kerr\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/github.blog\\\/ai-and-ml\\\/github-copilot\\\/github-for-beginners-code-review-and-refactoring-with-github-copilot\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/github.blog\\\/ai-and-ml\\\/github-copilot\\\/github-for-beginners-code-review-and-refactoring-with-github-copilot\\\/\"},\"author\":{\"name\":\"Kedasha Kerr\",\"@id\":\"https:\\\/\\\/github.blog\\\/#\\\/schema\\\/person\\\/c7307d5b9eb99168bed497b7e6b0a950\"},\"headline\":\"GitHub for Beginners: Code review and refactoring with GitHub Copilot\",\"datePublished\":\"2025-06-09T13:00:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/github.blog\\\/ai-and-ml\\\/github-copilot\\\/github-for-beginners-code-review-and-refactoring-with-github-copilot\\\/\"},\"wordCount\":1381,\"image\":{\"@id\":\"https:\\\/\\\/github.blog\\\/ai-and-ml\\\/github-copilot\\\/github-for-beginners-code-review-and-refactoring-with-github-copilot\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/github.blog\\\/wp-content\\\/uploads\\\/2025\\\/02\\\/418127171-3bd956ac-6856-4c72-8601-010f10058417.png?fit=2400%2C1260\",\"keywords\":[\"code review\",\"GitHub Copilot\",\"GitHub for beginners\",\"refactoring code\"],\"articleSection\":[\"AI &amp; ML\",\"GitHub Copilot\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/github.blog\\\/ai-and-ml\\\/github-copilot\\\/github-for-beginners-code-review-and-refactoring-with-github-copilot\\\/\",\"url\":\"https:\\\/\\\/github.blog\\\/ai-and-ml\\\/github-copilot\\\/github-for-beginners-code-review-and-refactoring-with-github-copilot\\\/\",\"name\":\"GitHub for Beginners: Code review and refactoring with GitHub Copilot - The GitHub Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/github.blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/github.blog\\\/ai-and-ml\\\/github-copilot\\\/github-for-beginners-code-review-and-refactoring-with-github-copilot\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/github.blog\\\/ai-and-ml\\\/github-copilot\\\/github-for-beginners-code-review-and-refactoring-with-github-copilot\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/github.blog\\\/wp-content\\\/uploads\\\/2025\\\/02\\\/418127171-3bd956ac-6856-4c72-8601-010f10058417.png?fit=2400%2C1260\",\"datePublished\":\"2025-06-09T13:00:00+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/github.blog\\\/#\\\/schema\\\/person\\\/c7307d5b9eb99168bed497b7e6b0a950\"},\"description\":\"Learn how to use GitHub Copilot to help review and polish your code.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/github.blog\\\/ai-and-ml\\\/github-copilot\\\/github-for-beginners-code-review-and-refactoring-with-github-copilot\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/github.blog\\\/ai-and-ml\\\/github-copilot\\\/github-for-beginners-code-review-and-refactoring-with-github-copilot\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/github.blog\\\/ai-and-ml\\\/github-copilot\\\/github-for-beginners-code-review-and-refactoring-with-github-copilot\\\/#primaryimage\",\"url\":\"https:\\\/\\\/github.blog\\\/wp-content\\\/uploads\\\/2025\\\/02\\\/418127171-3bd956ac-6856-4c72-8601-010f10058417.png?fit=2400%2C1260\",\"contentUrl\":\"https:\\\/\\\/github.blog\\\/wp-content\\\/uploads\\\/2025\\\/02\\\/418127171-3bd956ac-6856-4c72-8601-010f10058417.png?fit=2400%2C1260\",\"width\":2400,\"height\":1260},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/github.blog\\\/ai-and-ml\\\/github-copilot\\\/github-for-beginners-code-review-and-refactoring-with-github-copilot\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/github.blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"AI &amp; ML\",\"item\":\"https:\\\/\\\/github.blog\\\/ai-and-ml\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"GitHub Copilot\",\"item\":\"https:\\\/\\\/github.blog\\\/ai-and-ml\\\/github-copilot\\\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"GitHub for Beginners: Code review and refactoring with GitHub Copilot\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/github.blog\\\/#website\",\"url\":\"https:\\\/\\\/github.blog\\\/\",\"name\":\"The GitHub Blog\",\"description\":\"Updates, ideas, and inspiration from GitHub to help developers build and design software.\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/github.blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/github.blog\\\/#\\\/schema\\\/person\\\/c7307d5b9eb99168bed497b7e6b0a950\",\"name\":\"Kedasha Kerr\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/f7068adc72a5044fad52dad7d2a26c374860c1e491761f8ec5cf7750152f4adb?s=96&d=mm&r=g76275409088bcdfde49439d0290b472b\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/f7068adc72a5044fad52dad7d2a26c374860c1e491761f8ec5cf7750152f4adb?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/f7068adc72a5044fad52dad7d2a26c374860c1e491761f8ec5cf7750152f4adb?s=96&d=mm&r=g\",\"caption\":\"Kedasha Kerr\"},\"description\":\"Kedasha is a Developer Advocate at GitHub where she enjoys sharing the lessons she's learned with the wider developer community. She finds joy in helping others learn about the tech industry and loves sharing her experience as a software developer. Find her online @itsthatladydev.\",\"url\":\"https:\\\/\\\/github.blog\\\/author\\\/ladykerr\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"GitHub for Beginners: Code review and refactoring with GitHub Copilot - The GitHub Blog","description":"Learn how to use GitHub Copilot to help review and polish your code.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/github.blog\/ai-and-ml\/github-copilot\/github-for-beginners-code-review-and-refactoring-with-github-copilot\/","og_locale":"en_US","og_type":"article","og_title":"GitHub for Beginners: Code review and refactoring with GitHub Copilot","og_description":"Learn how to use GitHub Copilot to help review and polish your code.","og_url":"https:\/\/github.blog\/ai-and-ml\/github-copilot\/github-for-beginners-code-review-and-refactoring-with-github-copilot\/","og_site_name":"The GitHub Blog","article_published_time":"2025-06-09T13:00:00+00:00","og_image":[{"width":2400,"height":1260,"url":"https:\/\/github.blog\/wp-content\/uploads\/2025\/02\/418127171-3bd956ac-6856-4c72-8601-010f10058417.png?fit=2400%2C1260","type":"image\/png"}],"author":"Kedasha Kerr","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Kedasha Kerr","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/github.blog\/ai-and-ml\/github-copilot\/github-for-beginners-code-review-and-refactoring-with-github-copilot\/#article","isPartOf":{"@id":"https:\/\/github.blog\/ai-and-ml\/github-copilot\/github-for-beginners-code-review-and-refactoring-with-github-copilot\/"},"author":{"name":"Kedasha Kerr","@id":"https:\/\/github.blog\/#\/schema\/person\/c7307d5b9eb99168bed497b7e6b0a950"},"headline":"GitHub for Beginners: Code review and refactoring with GitHub Copilot","datePublished":"2025-06-09T13:00:00+00:00","mainEntityOfPage":{"@id":"https:\/\/github.blog\/ai-and-ml\/github-copilot\/github-for-beginners-code-review-and-refactoring-with-github-copilot\/"},"wordCount":1381,"image":{"@id":"https:\/\/github.blog\/ai-and-ml\/github-copilot\/github-for-beginners-code-review-and-refactoring-with-github-copilot\/#primaryimage"},"thumbnailUrl":"https:\/\/github.blog\/wp-content\/uploads\/2025\/02\/418127171-3bd956ac-6856-4c72-8601-010f10058417.png?fit=2400%2C1260","keywords":["code review","GitHub Copilot","GitHub for beginners","refactoring code"],"articleSection":["AI &amp; ML","GitHub Copilot"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/github.blog\/ai-and-ml\/github-copilot\/github-for-beginners-code-review-and-refactoring-with-github-copilot\/","url":"https:\/\/github.blog\/ai-and-ml\/github-copilot\/github-for-beginners-code-review-and-refactoring-with-github-copilot\/","name":"GitHub for Beginners: Code review and refactoring with GitHub Copilot - The GitHub Blog","isPartOf":{"@id":"https:\/\/github.blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/github.blog\/ai-and-ml\/github-copilot\/github-for-beginners-code-review-and-refactoring-with-github-copilot\/#primaryimage"},"image":{"@id":"https:\/\/github.blog\/ai-and-ml\/github-copilot\/github-for-beginners-code-review-and-refactoring-with-github-copilot\/#primaryimage"},"thumbnailUrl":"https:\/\/github.blog\/wp-content\/uploads\/2025\/02\/418127171-3bd956ac-6856-4c72-8601-010f10058417.png?fit=2400%2C1260","datePublished":"2025-06-09T13:00:00+00:00","author":{"@id":"https:\/\/github.blog\/#\/schema\/person\/c7307d5b9eb99168bed497b7e6b0a950"},"description":"Learn how to use GitHub Copilot to help review and polish your code.","breadcrumb":{"@id":"https:\/\/github.blog\/ai-and-ml\/github-copilot\/github-for-beginners-code-review-and-refactoring-with-github-copilot\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/github.blog\/ai-and-ml\/github-copilot\/github-for-beginners-code-review-and-refactoring-with-github-copilot\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/github.blog\/ai-and-ml\/github-copilot\/github-for-beginners-code-review-and-refactoring-with-github-copilot\/#primaryimage","url":"https:\/\/github.blog\/wp-content\/uploads\/2025\/02\/418127171-3bd956ac-6856-4c72-8601-010f10058417.png?fit=2400%2C1260","contentUrl":"https:\/\/github.blog\/wp-content\/uploads\/2025\/02\/418127171-3bd956ac-6856-4c72-8601-010f10058417.png?fit=2400%2C1260","width":2400,"height":1260},{"@type":"BreadcrumbList","@id":"https:\/\/github.blog\/ai-and-ml\/github-copilot\/github-for-beginners-code-review-and-refactoring-with-github-copilot\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/github.blog\/"},{"@type":"ListItem","position":2,"name":"AI &amp; ML","item":"https:\/\/github.blog\/ai-and-ml\/"},{"@type":"ListItem","position":3,"name":"GitHub Copilot","item":"https:\/\/github.blog\/ai-and-ml\/github-copilot\/"},{"@type":"ListItem","position":4,"name":"GitHub for Beginners: Code review and refactoring with GitHub Copilot"}]},{"@type":"WebSite","@id":"https:\/\/github.blog\/#website","url":"https:\/\/github.blog\/","name":"The GitHub Blog","description":"Updates, ideas, and inspiration from GitHub to help developers build and design software.","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/github.blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/github.blog\/#\/schema\/person\/c7307d5b9eb99168bed497b7e6b0a950","name":"Kedasha Kerr","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/f7068adc72a5044fad52dad7d2a26c374860c1e491761f8ec5cf7750152f4adb?s=96&d=mm&r=g76275409088bcdfde49439d0290b472b","url":"https:\/\/secure.gravatar.com\/avatar\/f7068adc72a5044fad52dad7d2a26c374860c1e491761f8ec5cf7750152f4adb?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/f7068adc72a5044fad52dad7d2a26c374860c1e491761f8ec5cf7750152f4adb?s=96&d=mm&r=g","caption":"Kedasha Kerr"},"description":"Kedasha is a Developer Advocate at GitHub where she enjoys sharing the lessons she's learned with the wider developer community. She finds joy in helping others learn about the tech industry and loves sharing her experience as a software developer. Find her online @itsthatladydev.","url":"https:\/\/github.blog\/author\/ladykerr\/"}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/github.blog\/wp-content\/uploads\/2025\/02\/418127171-3bd956ac-6856-4c72-8601-010f10058417.png?fit=2400%2C1260","jetpack_shortlink":"https:\/\/wp.me\/pamS32-n3n","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/github.blog\/wp-json\/wp\/v2\/posts\/88621","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/github.blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/github.blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/github.blog\/wp-json\/wp\/v2\/users\/2041"}],"replies":[{"embeddable":true,"href":"https:\/\/github.blog\/wp-json\/wp\/v2\/comments?post=88621"}],"version-history":[{"count":3,"href":"https:\/\/github.blog\/wp-json\/wp\/v2\/posts\/88621\/revisions"}],"predecessor-version":[{"id":88635,"href":"https:\/\/github.blog\/wp-json\/wp\/v2\/posts\/88621\/revisions\/88635"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/github.blog\/wp-json\/wp\/v2\/media\/82914"}],"wp:attachment":[{"href":"https:\/\/github.blog\/wp-json\/wp\/v2\/media?parent=88621"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/github.blog\/wp-json\/wp\/v2\/categories?post=88621"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/github.blog\/wp-json\/wp\/v2\/tags?post=88621"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/github.blog\/wp-json\/wp\/v2\/coauthors?post=88621"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}