I’ve been using GitHub for years now, but I hadn’t really taken advantage of the “Viewed” checkbox on the right side of the file listing while reviewing PRs until a teammate pointed it out to me and mentioned its usefulness beyond indicating simply that the file had been viewed.
It turns out that if you use it in the way it was intended, the “Viewed” checkbox can save you some real headaches on a sizable PR, especially one that you know you’re going to have to revisit potentially more than once.
If you read the following description of the feature, it explains what it’s useful for:
Reviewing proposed changes in a pull request – GitHub Help
If the file changes after you view the file, it will be unmarked as viewed.
What that is really saying is that, in the time between your completing the first pass at a review of the PR, when you return to the list of files the files that have changed will be unchecked. Great! 👍🏻
Additionally, as the documentation states prior to the above quote, when you click the “Viewed” button, it also collapses the file down to a small rectangular region and hides the file contents.
What it’s not telling you is that GitHub is actually a little more helpful, because upon returning, it will actually do three things if a file has changed since your last visit:
- Unchecks the “Viewed” checkbox
- Adds a yellow box with a “Changed since last view” label in it, which is nice and visible
- Expands the file on the page, making it obvious that the file has changed in the interim
These three things are super helpful at identifying the areas of code that have changed since you last viewed the code set. You can immediately see what has changed and focus your attention on those changed files.
This is a very useful feature, especially for large PRs. I probably wouldn’t use it much for smaller PRs, because they are easier to keep track of – but some PRs can get pretty big and include a large number of files, so they really benefit from this feature.
So, the next time you are facing a large PR, try using the “Viewed” checkbox on those files and see if it helps!