AI Hints
Home›Git & GitHub Tutorial›Pull Requests
Git & GitHub · Lesson 71 of 144

Code Review

Comments, changes, approval.

⏱ 2 min read▶ Video at 1:17:40🎓 Free
Watch this lesson in the Git & GitHub courseWatch on YouTube ↗Full Git & GitHub course

Once a pull request is open, teammates review it. They read the changes, leave comments, and either approve it, or ask for changes. Reviewing code is one of the best ways to learn.

Code Review
From the video: Code Review
  • Teammates read the changes
  • Comment, approve, or ask for changes
  • A great way to learn

Three review results

A reviewer can leave a comment, just a question or an idea. They can request changes, which means please fix something first. Or they can approve, which means it looks good to merge. Comments can be on the whole pull request, or on one exact line of code.

Commenta question or idea
Request changesfix this first
Approveready to merge
Line commentson exact lines

Updating a pull request

A reviewer asks you to add a page title to the blog. No need for a new pull request. Just commit the fix on the same branch, and push. The pull request updates automatically, with the new commit.

git
echo '<title>My Blog</title>' >> blog.html
git commit -am "Add page title to blog"
[add-blog 847093a] Add page title to blog
 1 file changed, 1 insertion(+)
git push
To https://github.com/sam/my-site.git
   a05e8bd..847093a  add-blog -> add-blog

Summary

Reviewers comment, request changes, or approve. To update a pull request, just push more commits to its branch. Next, merging it.

Key takeaways
  • Comment, request changes, approve
  • Push fixes to the same branch
  • The PR updates itself
Next up: Merging a Pull Request — three ways to merge