|
| 1 | +--- |
| 2 | +title: Accelerating pull requests in your company with GitHub Copilot |
| 3 | +shortTitle: Accelerate pull requests |
| 4 | +intro: 'Understand features, enable developers, and measure Copilot''s impact.' |
| 5 | +versions: |
| 6 | + feature: copilot |
| 7 | +product: '{% data variables.copilot.copilot_for_business %} or {% data variables.copilot.copilot_enterprise %}' |
| 8 | +allowTitleToDifferFromFilename: true |
| 9 | +--- |
| 10 | + |
| 11 | +{% data reusables.copilot.essp-intro %} |
| 12 | + |
| 13 | +## 1. Identify barriers to success |
| 14 | + |
| 15 | +{% data reusables.copilot.identify-barriers-intro %} |
| 16 | + |
| 17 | +Teams often experience delays in merging pull requests due to lengthy review cycles. These delays often stem from: |
| 18 | + |
| 19 | +* Complex code changes that are difficult to understand |
| 20 | +* Inconsistent code formatting that makes reviews challenging |
| 21 | +* A general lack of context provided with the changes |
| 22 | +* Social factors that contribute to slow or hard-to-address reviews |
| 23 | + |
| 24 | +Reviewers can also easily miss small errors that may lead to production issues. |
| 25 | + |
| 26 | +This leads to bottlenecks in the development process and slows down the overall delivery and quality of features. |
| 27 | + |
| 28 | +## 2. Evaluate your options |
| 29 | + |
| 30 | +{% data reusables.copilot.evaluate-options-intro %} |
| 31 | + |
| 32 | +<a href="https://github.com/github-copilot/purchase?ref_cta=Copilot+Enterprise+trial&ref_cta=Copilot+Business+trial&ref_loc=accelerate-pull-requests" target="_blank" class="btn btn-primary mt-3 mr-3 no-underline"><span>Sign up for {% data variables.product.prodname_copilot_short %}</span> {% octicon "link-external" height:16 aria-label="link-external" %}</a> |
| 33 | + |
| 34 | +### How {% data variables.product.prodname_copilot_short %} can help |
| 35 | + |
| 36 | +{% data variables.product.prodname_copilot %} offers a suite of features designed to accelerate the pull request review process, enhance code quality, and improve collaboration, ultimately leading to faster merge times. |
| 37 | + |
| 38 | +By leveraging {% data variables.product.prodname_copilot_short %}'s capabilities, teams can streamline their workflows, reduce friction, and ensure consistent, high-quality code. |
| 39 | + |
| 40 | +#### Generates complete and helpful PR summaries |
| 41 | + |
| 42 | +{% data variables.product.prodname_copilot_short %} can automatically generate clear and concise PR summaries, saving developers time and ensuring that the purpose and changes of the PR are easily understood by reviewers. This reduces the likelihood of misunderstandings and speeds up the review process. |
| 43 | + |
| 44 | +#### Assists reviewers during their review process |
| 45 | + |
| 46 | +{% data variables.product.prodname_copilot %} can be used as a powerful PR review companion. |
| 47 | + |
| 48 | +* {% data variables.product.prodname_copilot_short %} can help explain complex code changes so that reviewers more quickly understand what the PR is contributing. |
| 49 | +* {% data variables.product.prodname_copilot_short %} can provide repository-wide, context-aware suggestions and potential code improvements directly within the pull request review interface on {% data variables.product.github %}, helping reviewers catch potential issues and offer constructive feedback more efficiently. |
| 50 | +* {% data variables.product.prodname_copilot_short %} can help reviewers draft and write clear, consistent, and effective review comments. |
| 51 | + |
| 52 | +#### Reviews based on organization guidelines |
| 53 | + |
| 54 | +* {% data variables.product.prodname_copilot_short %} can review code changes in your IDE before opening a pull request, or be assigned as reviewer to a pull request. |
| 55 | +* With rulesets, you can set up {% data variables.product.prodname_copilot_short %} to systematically review pull requests based on custom criteria. |
| 56 | +* With coding guidelines for reviews ({% data variables.copilot.copilot_enterprise_short %} only), {% data variables.product.prodname_copilot_short %} can enforce organizational coding standards and best practices, automatically flagging potential violations and suggesting fixes. |
| 57 | + |
| 58 | +These features ensure consistency across the codebase and help you catch errors early in the development process, reducing the need for manual code reviews and saving time for developers and reviewers. |
| 59 | + |
| 60 | +#### Suggests code fixes |
| 61 | + |
| 62 | +Based on a pull request review comment, {% data variables.product.prodname_copilot_short %} can help pull request authors quickly implement the required code changes to resolve the review. |
| 63 | + |
| 64 | +### Cultural considerations |
| 65 | + |
| 66 | +{% data reusables.copilot.cultural-factors-intro %} |
| 67 | + |
| 68 | +* Teams might **wait too long to release**, deploying large batches of code at once. This could be caused by a fear of destabilization with frequent releases, a lack of CI/CD pipeline maturity, or strict compliance requirements. |
| 69 | +* Developers might **spend too long perfecting code** or adding unnecessary features. This could be caused by a culture of perfectionism or a lack of effective prioritization. |
| 70 | +* Developers might **build overly complex solutions** for simple problems. This could be caused by a desire to future-proof unnecessarily, or pressure to add value through complexity. |
| 71 | + |
| 72 | +## 3. Implement changes |
| 73 | + |
| 74 | +{% data reusables.copilot.implement-changes-intro %} |
| 75 | + |
| 76 | +* [Create helpful pull request summaries](#create-helpful-pull-request-summaries) |
| 77 | +* [Use {% data variables.product.prodname_copilot_short %} as a review assistant](#use-copilot-as-a-review-assistant) |
| 78 | +* [Add {% data variables.product.prodname_copilot_short %} as a reviewer](#add-copilot-as-a-reviewer) |
| 79 | +* [Get help implementing review comments](#get-help-implementing-review-comments) |
| 80 | +* [Best practices for developers](#best-practices-for-developers) |
| 81 | +* [Resources](#resources) |
| 82 | + |
| 83 | +### Create helpful pull request summaries |
| 84 | + |
| 85 | +1. When creating a pull request, click the {% data variables.product.prodname_copilot_short %} icon in the "Add a description" field, then click **Summary**. |
| 86 | +1. {% data variables.product.prodname_copilot_short %} will scan through the pull request and provide an overview of the changes made in prose, as well as a bulleted list of changes with the files that they impact. |
| 87 | +1. Check you're happy with {% data variables.product.prodname_copilot_short %}'s description. |
| 88 | +1. When reviewers come to your pull request, they'll have all the context they need to leave a review. |
| 89 | + |
| 90 | +### Use {% data variables.product.prodname_copilot_short %} as a review assistant |
| 91 | + |
| 92 | +When jumping into a pull request as a reviewer, you can use {% data variables.product.prodname_copilot_short %} to speed up your review. |
| 93 | + |
| 94 | +1. Use {% data variables.product.prodname_copilot_short %} to **understand the changes in the pull request**. |
| 95 | + |
| 96 | + * Ask {% data variables.product.prodname_copilot_short %} to summarize the changes made to a file, particularly helpful for longer diffs. You can pick a specific file from the diff by clicking {% octicon "kebab-horizontal" aria-label="Show options" %} on the top-right corner of the file. |
| 97 | + |
| 98 | +  |
| 99 | + |
| 100 | + * For changes in specific lines, highlight the lines you want to better understand and ask {% data variables.product.prodname_copilot_short %} to explain the changes to you. You can highlight a set of lines by clicking on the uppermost line number first, holding your SHIFT key, and then clicking on the lowermost line of the diff. |
| 101 | + |
| 102 | +  |
| 103 | + |
| 104 | +1. **Collaborate on your PR review** with {% data variables.product.prodname_copilot_short %}. Don't forget to attach the specific file diffs to the conversation before prompting {% data variables.product.prodname_copilot_short %}. |
| 105 | + |
| 106 | + * You can ask {% data variables.product.prodname_copilot_short %} for its own opinion on the PR changes by asking: `Provide your judgement as a PR Reviewer, both for functional and non-functional aspects that these changes bring`. Note how this prompt asks {% data variables.product.prodname_copilot_short %} to consider both functional and non-functional aspects of the code. |
| 107 | + |
| 108 | + * For your own PR review comments, ask {% data variables.product.prodname_copilot_short %} for a second opinion: `As my peer reviewer on this pull request, give me your feedback on my own review: YOUR-REVIEW-COMMENT. Do you think it's pertinent? Am I missing something?` |
| 109 | + |
| 110 | +1. Collaborate with {% data variables.product.prodname_copilot_short %} to **draft and refine your review comments**. |
| 111 | + |
| 112 | + * After planning the review with {% data variables.product.prodname_copilot_short %}, you can ask to list the comments that you should provide: `Make a list of review comments to add to the PR and tell me exactly in which file diff and lines each comment should be added`. |
| 113 | + * You can also ask {% data variables.product.prodname_copilot_short %} to create a first draft of a review comment you have in mind or refine a comment before you post it: `Help me draft review comments as discussed` or `Refine this review comment to make it clear, concise, and actionable`. |
| 114 | + |
| 115 | +### Add {% data variables.product.prodname_copilot_short %} as a reviewer |
| 116 | + |
| 117 | +To reduce review times and merge pull requests faster, use {% data variables.product.prodname_copilot_short %} code reviews systematically: first in the IDE before opening the pull request, then on the PR in {% data variables.product.github %}. |
| 118 | + |
| 119 | +Using {% data variables.product.prodname_copilot_short %} code review does not replace the need for human code review. However, following the steps above can help humans complete their reviews faster. |
| 120 | + |
| 121 | +* **Developers** should request a review of all their changes using {% data variables.product.prodname_copilot_short %} code review before opening a pull request. |
| 122 | +* **Administrators** should set up repository or organization rulesets to automatically add {% data variables.product.prodname_copilot_short %} as a reviewer on any pull request targeting protected branches. |
| 123 | +* **Team leads** should capture their team's standard style and rules and set them as coding guidelines for the organization so that {% data variables.product.prodname_copilot_short %} can leverage them in reviews. |
| 124 | + * Ensure your coding guidelines capture a minimum set of styling recommendations that make code more readable, which will help during the pull request review process. |
| 125 | + * To reduce the amount of PR review comments due to styling issues, set the same recommendations in {% data variables.product.prodname_copilot_short %} instructions at the repository and organization level. This way, the code generated by {% data variables.product.prodname_copilot_short %} will conform to these guidelines. |
| 126 | + |
| 127 | +### Get help implementing review comments |
| 128 | + |
| 129 | +Pull request authors can speed up resolution of PR review comments by quickly implementing fixes with {% data variables.product.prodname_copilot_short %}'s assistance. |
| 130 | + |
| 131 | +* For any review comments left by {% data variables.product.prodname_copilot_short %} itself, either commit the proposed fix directly, or edit it in Copilot Workspace before committing. |
| 132 | +* For any review comments left by peers, navigate to the file diff related to the PR review comment and attach the diff to a {% data variables.copilot.copilot_chat_short %} conversation. Then, copy paste the review comment with a prompt like this: `Suggest a fix for this review comment:` |
| 133 | +* If you are using VS Code, ask {% data variables.product.prodname_copilot %} in agent mode to implement the required changes from the review comment. |
| 134 | + |
| 135 | +### Best practices for developers |
| 136 | + |
| 137 | +Developers **should**: |
| 138 | + |
| 139 | +* Request {% data variables.product.prodname_copilot_short %}'s review in your IDE before pushing to catch and resolve issues early. |
| 140 | +* Use {% data variables.product.prodname_copilot_short %} to plan and refine your own PR review comments to help PR authors understand and resolve issues. |
| 141 | +* Attach relevant diff context, including specific lines of code, to your conversations with {% data variables.product.prodname_copilot_short %}. |
| 142 | + |
| 143 | +Developers **should not**: |
| 144 | + |
| 145 | +* Apply {% data variables.product.prodname_copilot_short %}'s suggestions without testing. |
| 146 | +* Rely solely on {% data variables.product.prodname_copilot_short %} for reviews. |
| 147 | +* Neglect code readability. |
| 148 | + |
| 149 | +### Resources |
| 150 | + |
| 151 | +* [AUTOTITLE](/copilot/using-github-copilot/using-github-copilot-for-pull-requests/creating-a-pull-request-summary-with-github-copilot) |
| 152 | +* [AUTOTITLE](/copilot/using-github-copilot/code-review/using-copilot-code-review?tool=vscode#reviewing-changes) |
| 153 | +* [AUTOTITLE](/copilot/using-github-copilot/code-review/configuring-coding-guidelines) |
| 154 | +* [AUTOTITLE](/copilot/using-github-copilot/code-review/configuring-automatic-code-review-by-copilot) |
| 155 | +* [AUTOTITLE](/copilot/customizing-copilot/adding-organization-custom-instructions-for-github-copilot) |
| 156 | + |
| 157 | +## Metrics to watch |
| 158 | + |
| 159 | +{% data reusables.copilot.measure-changes-intro %} |
| 160 | + |
| 161 | +* **Developer satisfaction**: Use developer surveys to measure satisfaction with engineering tooling. |
| 162 | +* **Pull requests merged per developer**: You can use GitHub's `pull request` webhook, ensuring `action` is `closed` and the `merged` property inside `pull request` object is `true`. |
| 163 | +* **Pull requests lead time**: Measure the average length of time between PR creation and merge. |
0 commit comments