Reviewing through GitHub Pull Requests
The Git collaborative workflow revolves around creating branches, making edits and changes on those branches, and submitting pull requests of those branches to be merged into the main branch. A key part of this workflow is the review part, where someone will look over the changes made and if necessary request new changes or fixes before the pull request can be merged.
So how do you do a review of a pull request. Thankfully GitHub has a pretty decent set of instructions on how to do them.
This is the main listing page of the documents related to doing reviews.
These two instruction page here and here detail how to add comments to a pull request.
Briefly, the steps you take to review a pull request is:
- Open the pull request.
- Go to the “Files changed” tab. This tab shows what text has been added (in green) or removed (in red).
- Review the removed and added changes. If you have comments to give, hover with the cursor on the line you want to comment on. There will be a blue plus button that pops up on the left of the line number.
- To add a comment, click the blue button and a text box will pop up. Write your comment there. Almost always, you will want to click the “Start a review” green button.
- When you are, scroll to the top and click the green “Review changes” button. You can optionally write a general comment in the text box, otherwise, select one of the options: “Approve”, “Request changes”, or “Comment”. Then click the “Submit review”.
- You have now finished the review!
For a short 4 minute demonstration, check out the YouTube below on doing a pull request review.
There’s also a much longer presentation (40 minutes) by GitHub talking about some of the reasons and concepts behind pull requests, code reviews, and working with the “GitHub Flow” workflow (making branches, submitting pull requests, getting reviewed, and merging). This is more for learning to have a better understanding of what and why the “GitHub Flow” is useful for collaboration.