1. Reviewing pull requests
Amazing work! The final step is to respond to the PR, and to do that, we need to review it.
2. How to request a review of a PR
Here is the PR we created before. This time, we’re going to request a review. This works similarly to assigning someone, except we click on the gear icon in the Reviewers section. This will provide a list of everyone that can review a PR for this repo.
3. Assign vs. Review
Although the process is similar, we must differentiate between an assignee and a reviewer. The assignee is responsible for approving the PR, while the reviewer is responsible for looking at the changes being suggested.
4. How to request a review of a PR
Here, we have requested a review from this user.
5. How to review a PR
Let’s switch positions and become that reviewer. We’ll navigate to the Pull requests tab in our repository. Here we have a view of the PRs we need to review.
6. How to review a PR
We click on it
7. How to review a PR
and navigate to the Files changed tab, where we can review the proposed changes.
8. Reviewing a PR
This view shows us all the changed files and what has been added or removed. The red highlights indicate a removal,
9. Reviewing a PR
while the green indicates an addition.
10. Reviewing a PR
We click on review changes to begin the process.
11. Adding comments to a PR
We can also add comments to specific lines if we have questions or need further clarification. To do this, we hover over the line of code and click on the blue square icon with a white plus sign.
12. Adding comments to a PR
This opens a comment box where we can add our comments.
13. Adding comments to a PR
Alternatively, we can select all relevant lines before clicking on the icon to add a comment if we want to refer to multiple lines.
14. Responding to a PR
At this point, our PR comments are only visible to us. We need to respond to the PR to submit the comments. We have three options: to comment only, to submit the comments and approve, or to submit the comments and request additional changes. In this case, we have one request we’d like to address before merging, so we click the Request changes option.
15. Comment vs. Request changes
Let's take a moment to differentiate between commenting and requesting changes. Both actions look the same in practice, but the options are different. A comment implies feedback or suggestions that are not required to be incorporated,
16. Comment vs. Request changes
while the request changes option confirms that the comment does include things that need to be incorporated.
17. Requesting changes
Once we select an option, an alert reaches the contributor where they can make the requested changes
18. Requesting changes
and then resubmit by selecting Re-request review.
19. Approving a PR
We’re now ready to approve the PR. We follow the same process as before. This time we are happy with everything and select Approve,
20. Merging a PR
and merge the PR by hitting Merge Pull Request followed by
21. Merging a PR
Confirm Merge.
22. Deleting a branch after a PR
Once a PR is complete, the changes merge into the base branch. To keep a clean workflow, it’s good practice to delete the branch where the changes came from. There may be some instances where we need to restore the branch, for example, if we missed an error that should have been removed. We do have the option to restore a branch after it has been deleted.
23. Restoring a deleted branch
If we are still in the PR window, the delete button will have changed into a restore button which we can click to bring the branch back.
24. Restoring from a closed PR
Alternatively, we can navigate to the Pull requests tab and see all previous PRs from branches -
25. Restoring from a closed PR
here, we have zero open and one closed. We click on closed,
26. Restoring from a closed PR
select the one we want to restore,
27. Restoring from a closed PR
and see the same restore button at the bottom of the page.
28. Let's practice!
Now it’s your turn to practice reviewing PRs.