Link Search Menu Expand Document

Code Reviews: Reviewing a merged PR

It is unusual to do a code review on a PR that has already been merged.

However, there are times during the course when, as an exercise, a student may need to do a code review to satisfy the requirements of an assignment, and there are no open pull requests to review. In that case, here is a workaround: you can do a review on a merged PR. It looks a little different from the normal workflow though, so this page exists to show what that looks like.

Steps:

  1. Navigate to the PR
  2. Select the Files Changed tab.
  3. Click the Review Changes button at right.
  4. Write a comment in the box, e.g. LGTM or I wonder if it would have been better to do it this way ... (explanation goes here)
  5. Click Submit

This animation shows what that looks like:

reviewing-a-merged-PR

And here’s what that looks like in the timeline of the PR:

image

By contrast, this is what a regular comment looks like:

image

Note the difference: the code review has the words reviewed and a link to the reviewed changes.

image

Why does it matter?

It may seem “picky” that we are making a distinction between these two things, but it does actually matter—one difference is that when you set up something called branch protection rules in Github, a proper approving “code review” will make a PR eligble to be merged, while a simple “LGTM” comment will not.

In the case of an already merged PR, of course it doesn’t matter. But we want to make sure that you do understand the difference, so that you don’t end up doing it the wrong way at an internship or job later on.