AbdulElahGwaith's picture
Upload folder using huggingface_hub
88df9e4 verified
metadata
title: Reviewing proposed changes in a pull request
intro: >-
  In a pull request, you can review and discuss commits, changed files, and the
  differences (or "diff") between the files in the base and compare branches.
redirect_from:
  - >-
    /github/collaborating-with-issues-and-pull-requests/reviewing-changes-in-pull-requests/reviewing-proposed-changes-in-a-pull-request
  - /articles/reviewing-proposed-changes-in-a-pull-request
  - >-
    /github/collaborating-with-issues-and-pull-requests/reviewing-proposed-changes-in-a-pull-request
  - >-
    /github/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/reviewing-proposed-changes-in-a-pull-request
versions:
  fpt: '*'
  ghes: '*'
  ghec: '*'
topics:
  - Pull requests
shortTitle: Review proposed changes

About reviewing pull requests

It's best to review changes in a pull request one file at a time:

  • Examine each individual file changed in the pull request.
  • Leave comments on specific changes.
  • After reviewing a file, mark it as Viewed to collapse it and track your progress.
  • The progress bar in the pull request header shows how many files you've viewed.
  • When you've finished, you can approve the pull request or request changes by submitting your review with a summary comment.

{% ifversion copilot %}

If the pull request was raised by {% data variables.product.prodname_copilot %} then, when you submit your comments, {% data variables.product.prodname_copilot_short %} will carry out more work to respond to your comments and will push a new commit to the pull request with further changes. See AUTOTITLE.

{% endif %}

{% webui %}

Understanding the purpose of the pull request

Gaining a clear understanding of the motivation behind a pull request helps inform your review, so you can keep it targeted and meaningful, and provide feedback that is aligned with the pull request author’s intent and the project's goals.

There are several options available to you to better understand the context and rationale for proposed changes.

Using the pull request sidebar for context

In the pull request sidebar, you can find valuable context including:

  • Linked issues or discussions: Review these to understand the problems or goals that the pull request aims to address, or to gather information on, for example, any background, design decisions, or current debates.
  • Linked projects or milestones: Review how this pull request fits within larger projects or upcoming releases.

Use this information to frame your review and check if the goals of the pull request align with the original intent.

{% ifversion copilot %}

Using {% data variables.copilot.copilot_chat_short %} to understand the rationale

You can ask {% data variables.copilot.copilot_chat_short %} for help understanding the pull request’s intent or for clarification on any part of the change.

  1. At the top right of the pull request page, click the {% octicon "copilot" aria-label="Copilot icon" %} button next to the search bar.

    {% data variables.copilot.copilot_chat_short %} is displayed, with the pull request attached as context to the prompt window.

  2. In the prompt box, type a question and press Enter. For example, you could enter:

    • What problem does this pull request solve?
    • Why were these changes needed?
    • Summarize the goals of this PR based on the linked issue.
    • How does this PR relate to issue ISSUE-URL?

{% data variables.copilot.copilot_chat_short %} can help you clarify the bigger picture before diving into line-level review.

{% endif %}

Starting a review

{% data reusables.repositories.sidebar-pr %} {% data reusables.repositories.choose-pr-review %} {% data reusables.repositories.changed-files %} You can change the format of the diff view in this tab by clicking {% octicon "gear" aria-label="The Settings gear" %} and choosing the unified or split view. The choice you make will apply when you view the diff for other pull requests.

Screenshot of the "Files changed" tab for a pull request. The "Diff view" menu is outlined in dark orange.

You can also choose to hide whitespace differences. The choice you make only applies to this pull request and will be remembered the next time you visit this page.

  1. Optionally, filter the files to show only the files you want to review or use the file tree to navigate to a specific file. For more information, see AUTOTITLE. {%- ifversion ghec %}
  2. Optionally, if you have access to {% data variables.copilot.copilot_enterprise %}, you can ask {% data variables.product.prodname_copilot_short %} about the changes in a file in a pull request by clicking {% octicon "kebab-horizontal" aria-label="Show options" %} at the top right of the file, clicking Ask {% data variables.product.prodname_copilot_short %} about this diff, then typing a request such as "Explain these changes." For more information, see AUTOTITLE. {%- endif %} {% data reusables.repositories.start-line-comment %} {% data reusables.repositories.multiple-lines-comment %} {% data reusables.repositories.type-line-comment %} {% data reusables.repositories.suggest-changes %} {% data reusables.repositories.start-file-comment %}
  3. When you're done, click Start a review. If you have already started a review, you can click Add review comment.

Before you submit your review, your line comments are pending and only visible to you. You can edit pending comments anytime before you submit your review. To cancel a pending review, including all of its pending comments, click Review changes above the changed code, then click Abandon review.

Screenshot of the comment field for a review. The "Abandon review" button is outlined in dark orange. {% endwebui %}

{% ifversion fpt or ghec %}

{% codespaces %}

Reviewing a pull request

You can use {% data variables.product.prodname_github_codespaces %} to test, run, and review pull requests.

  1. Open the pull request in a codespace, as described in AUTOTITLE.

  2. In the Activity Bar, click the {% data variables.product.github %} Pull Request view. This view only appears when you open a pull request in a codespace.

    Screenshot of the {% data variables.product.prodname_vscode_shortname %} Activity Bar. The mouse pointer is hovering over an icon displaying the tooltip "{% data variables.product.prodname_dotcom %} Pull Request."

  3. To review a specific file, click the Open File icon in the Side Bar.

    Screenshot of the "{% data variables.product.prodname_dotcom %} Pull Request" side bar. A file name is highlighted with a dark orange outline.

  4. To add review comments, click the + icon next to the line number. Type your review comment and then click Start Review.

    Screenshot of a comment being added, reading "Yes, I agree, this is clearer." The "Start Review" button is shown below the comment.

{% data reusables.codespaces.reviewing-a-pr %}

  1. When you are finished adding review comments, from the Side Bar you can choose to either submit the comments, approve the changes, or request changes.

    Screenshot of the side bar showing the dropdown options "Comment and Submit," "Approve and Submit," and "Request Changes and Submit."

For more information on reviewing pull requests in {% data variables.product.prodname_github_codespaces %}, see AUTOTITLE.

{% endcodespaces %} {% endif %}

{% webui %} {% ifversion copilot %}

Understanding changes in a pull request

{% data reusables.copilot.copilot-requires-subscription %}

{% data variables.product.prodname_copilot %} can help you quickly understand the changes in a pull request by providing context and explanations for specific commits. If you’re unsure about the purpose of a particular change or need more details about how it fits into the broader codebase, you can ask {% data variables.product.prodname_copilot_short %} questions about individual commits.

  1. Navigate to a commit on {% data variables.product.github %}.

{% data reusables.copilot.open-copilot %}

  1. At the bottom of the {% data variables.product.prodname_copilot_short %} chat panel, in the "Ask {% data variables.product.prodname_copilot_short %}" box, type a question and press Enter. For example, you could enter:

    • Summarize the changes in this commit
    • Who committed these changes?
    • When was this commit made?

    If you know the SHA for a commit, instead of navigating to the commit, you can ask {% data variables.product.prodname_copilot_short %} about the commit from any page in the repository on {% data variables.product.github %} by including the SHA in your message. For example, What changed in commit a778e0eab?

{% data reusables.copilot.stop-response-generation %}

{% endif %}

Reviewing dependency changes

If the pull request contains changes to dependencies you can use the dependency review for a manifest or lock file to see what has changed and check whether the changes introduce security vulnerabilities. For more information, see AUTOTITLE.

{% data reusables.repositories.changed-files %}

  1. On the right of the header for a manifest or lock file, display the dependency review by clicking the {% octicon "file" aria-label="The rich diff icon" %} rich diff button.

    Screenshot of the "Files changed" tab of a pull request. The button to display the rich diff, labeled with a file icon, is outlined in dark orange.

{% data reusables.repositories.return-to-source-diff %}

Marking a file as viewed

After you finish reviewing a file, you can mark the file as viewed, and the file will collapse. If the file changes after you view the file, it will be unmarked as viewed.

{% data reusables.repositories.changed-files %}

  1. On the right of the header of the file you've finished reviewing, select Viewed.

    Screenshot of the header of a file. The "Viewed" option is outlined in dark orange.

Submitting your review

After you've finished reviewing all the files you want in the pull request, submit your review.

{% data reusables.repositories.changed-files %} {% data reusables.repositories.review-changes %} {% data reusables.repositories.review-summary-comment %}

  1. Select the type of review you'd like to leave:

    • Select Comment to leave general feedback without explicitly approving the changes or requesting additional changes.
    • Select Approve to submit your feedback and approve merging the changes proposed in the pull request.
    • Select Request changes to submit feedback that must be addressed before the pull request can be merged.

{% data reusables.repositories.submit-review %}

{% data reusables.repositories.request-changes-tips %}

{% endwebui %}

Further reading