How to mark all GitHub pull request files as not viewed
Today I learnt …
When you’re reviewing a pull request on GitHub it can be really useful to mark files as viewed. But sometimes you want to revisit all the files in a PR and, when it’s a large PR, it can be tedious to have to un-select ‘Viewed’ for every file. Fortunately, there’s an easier way.
With the PR code open in your browser, open up the Web Console1 and paste in the following JavaScript:
document
".js-reviewed-checkbox[checked]"
;
That will find all the ‘Viewed’ checkboxes that have been checked already and click on them for you, flipping the files to being un-viewed. You can add this bookmarklet to your browser bookmarks for future use:
Mark GitHub PR files as unviewed
As an extra bonus, if you add a keyword to the bookmark in Firefox — let’s say ‘unview’ — then you can type ‘unview’ into the address bar and it will run the JavaScript without leaving the page, and mark all files as un-viewed.
For Firefox and Safari, press ⌘⌥K (Mac) or ⌃⇧K (Windows/Linux). For Chrome and Edge, press F12.