A bookmarklet to allow you to filter the list of files in GitHub's comparison views.
When viewing a commit or pull request with a large number of modified files or lines, it might be helpful to have the ability to filter that list of files on the fly so that you can:
- review smaller chunks of it at one time
- ignore things that need no review or can't practically be reviewed (e.g., minified files)
-
Open up
dist/github-diff-filter.min.js
. -
Copy the entirety of its contents.
-
Create a new bookmark in your browser and paste what you copied (and only what you copied) into the URL field.
-
Visit a GitHub comparison page (e.g., the Files Changed tab on a Pull Request) and click the bookmarklet you just created.
-
Enter a query into the field and press
Return
or click the Hide button. -
Behold the magical disappearing files!
- Adds button to unhide all previously-hidden files.
- Adds ability to enter multiple comma-separated arguments into the text field.
- Design improvements.
- Now tested on Safari 6, Internet Explorer 9.
First release! Allows for simple hiding of files matching your query. Tested on Google Chrome 31+.
Some general, not-set-in-stone ideas for feature buildout order. It is unclear at what point we'll run into the character limit for a bookmark URL, at which point it will become much more difficult to add new features.
- Add to a list of activated filters each time the form is submitted.
- Allow for selective deactivation of single filters.
- Add a second form: Show only files matching this query
(e.g., show me only
.css
files)
Some UX work needed to figure out how best to handle this. Would it override hiding filters already set? Is it actually a second bookmarklet?
- Detect filetypes present and offer checkboxes to show/hide them.
- Insert checkboxes next to each file in the Diff Stats list for one-click hiding of that file.
- Make the file diffs themselves collapsible on demand.
- Proof of concept courtesy of @himedlooff: https://gist.github.com/himedlooff/9673813
We welcome your feedback and contributions. Filing issues and submitting pull requests is the best way to help out. If you want to contribute code, pick an item off the roadmap above and do it! It doesn't have to go in the proposed order. If something farther down the list speaks to you more, implement it!
@himedloof is working on some similar ideas in the form of a Chrome extension. Link forthcoming.