go to content go to search box go to global site navigation

Tech Blog

Our Top 7 GitHub Tricks

Whitespace

Reviewing changes on GitHub is great, however sometimes it's hard to focus on important changes when you're sifting through a pull request that has a bunch of whitespace changes. Luckily, by adding ?w=1 to the end of the URL whitespace will be ignored. To see whitespace again, simply remove the URL parameter.

Note: Be aware when using this option, you cannot see line comments and are unable to create them.

Before:

Diff with whitespace

After:

Diff with whitespace ignored

Search

Here are some handy customizations to refine your GitHub searches:

Finding gem versions within your organization

rails path:Gemfile @lonelyplanet

Perhaps there are some old repositories you want to ignore

rspec path:Gemfile @lonelyplanet -repo:lonelyplanet/openresty-statsd

Find all files that contain sloths within your organization

sloth in:file -extension:rb @lonelyplanet

Find sensitive information

Find local talent

location:"Nashville, TN" language:"Ruby" followers:>20

You can find more info on search syntax on GitHub Help.

Cross-references

Shipping something dependent on another repo

git commit -m "Roll out new UI from lonelyplanet/rizzo#782"

Late commit relating to a merged PR (will show up in the discussion)

git commit -m "(#1420) Fixes broken sloth animation"

The same thing can also be done from GitHub comments

Code comparison

You may already be familiar with using http://github.com/<org>/<repo>/compare to create a pull-request from a branch, but it's also super useful for filtering commits.

See what's changed in the last day Using git's date specifications {5 minutes ago} https://github.com/lonelyplanet/rizzo/compare/master@{1.day.ago}...master

Or what you're missing out on in your fork org/repo/compare/{foreign-user}:{branch}...{own-branch}

https://github.com/lonelyplanet/rizzo/compare/evantravers:master...master

There's more details on comparing commits on GitHub as well as info on git's date revisions

Keyboard shortcuts

The mouse is slow, keyboards are faster. Check out the list of shortcuts for the current page by pressing ?

Highlighting lines

Use line highlights to point out interesting bits of code to your mates #L{number}-{number}

Replying

Highlight the text you want to reply to and hit r. GitHub will quote the text for you

Demonstrate quoting in GitHub

Published