DEV Community

Cover image for A GitHub Whitespace Shortcut!
Lob
Lob

Posted on • Originally published at Medium

A GitHub Whitespace Shortcut!

As an engineer, I like to do things in as few steps as possible. If I can automate something, I will. However, one day I was complaining to my boss Ross about GitHub PRs and whitespaces.

It takes me three clicks to remove the whitespace from any PR. That’s at least two clicks too many in my opinion.

3 step process to remove whitespace

To ease my aching hand—and erase the black mark inefficiency leaves on my soul—my boss Ross showed me this little bookmark he made:

screenshot of bookmark in browser

Voila! With one click, I could get rid of all the whitespace in a PR and focus on the code I actually wanted to (i.e., functionality that changed).

How to add this shortcut

  1. Create a new bookmark. You can name it github whitespace or whatever you like.
  2. Edit your new bookmark.
  3. Add the following JavaScript script which will add the remove whitespace command to your window: javascript: (() => { window.location += '?w=1%27; })();

editing bookmark by adding code

  1. Save your bookmark.
  2. Go to a Github PR with a ton of whitespace changes.
  3. Click on your bookmark.
  4. Witness the magic!

Inefficiency be gone!

Brought to you by Krys Flores

Top comments (0)