Skip to content

GitHub Pro Tip: Hide red lines in a diff

by gnarf on April 9th, 2012

I was looking at a diff on GitHub today and said to myself, “This would be so much easier to review if all the red lines were hidden.”

So I pulled open the console and wrote a little jQuery:

$("div.diff-view .gd").closest("tr").toggle().length;

It can take a little time to run depending on the number of lines it needs to hide. The .length is there just to stop the console from showing you all of the elements it toggled.

I’ve given up on actually making an easy to install bookmarklet in my wordpress, something keeps converting all my links to javascript:void(0) and I don’t care enough to debug it.

If you want to bookmark it – here is the code for a bookmarklet:

javascript:$("div.diff-view .gd").closest("tr").toggle();false

Edit: And just to test if bookmarklet is working again: gh:~red — Hey Look at that! You can drag that to your bookmark bar and click it on a diff in github! Thanks StackOverflow!

From → GitHub, jQuery