GitHub Tips and Tricks

Published on by

GitHub Tips and Tricks image

I’ve compiled a list of my favorite GitHub tips and tricks that I use in my workflow daily. You might be familiar with some or even all of them, but I find that developers new to GitHub and veterans alike might pick up a new tip or two by sharing!

I’d love to hear from you about your favorite GitHub tips that save you time and improve your code workflow. Here’s my short list of GitHub tips and tricks I’ve loved lately:

Ignore Whitespace in Diffs with the ?w=1 Trick

You can remove whitespace from diffs with the ?w=1 query param. The w=1 query param removes whitespace-only diffs and only shows you lines with code changes. When looking at a large diff with lots of code cleanup and CS fixes this is very helpful to get at the heart of any code changes going along with the whitespace fixes.

I would suggest making separate pull requests for mass whitespace fixes, but sometimes you need to do some cleanup along the way, and removing whitespace diffs is an excellent way to get the point of the pull request quickly.

Commits by Author

You can find the contributions made by an author with the ?author=<github_username> query string param. I find this handy when I want to see my past contributions on a large project or single out a specific developer’s commits on a project. Here are my humble contributions to the Laravel framework, for example.

Linking to Files

This one comes from Derrick Reimer on Twitter. Press ‘y’ to transform the URL into a SHA-based reference:

???? When linking to a file on @github, press 'y' to transform the URL to a SHA-based reference. That way, the link will remain stable even if the underlying file changes in future commits.

— Derrick Reimer (@derrickreimer) May 30, 2018

Sharing the SHA-based reference is evergreen, meaning that the code won’t change in the same way compared to linking to a branch-based file URL like:
# VS a hash-based URL

Line Highlighting

Line highlighting is evident from the UI when you click a line number, but you can also link to a range of lines too. For example, the hash #L23-L30 would select the line range of lines 23-30. In tandem with the ‘y’ trick, the SHA-based URL will ensure your line number hash is accurate in the future.

You can also select a range of lines from a file by first clicking a line number from the GitHub UI, holding down “shift” and clicking the ending line:

Cross-Linking Issues

You can cross-link issues and pull requests with the following format in comments, pull request descriptions, etc.:


Based on that pattern, here’s an example:

Depends on laravelnews/my-package#123

I love using this tip between my private GitHub repositories and any internal libraries or packages that a pull request depends upon to merge. The other benefit is that GitHub automatically creates a reference in the issue so others can see the relationship.

Organizing Contribution Guidelines

Did you know that you can organize documents like issue templates and contribution guidelines in a docs/ folder or a .github folder? I recently learned about this trick, which is a neat way to organize the files around creating new issues and sharing contribution guidelines.

For example, you can organize the contributing document in the following locations:

Issue templates, pull request templates, and various other project resources work the same way:


Keyboard Shortcuts

If you’re getting into open-source and using GitHub in general, you can learn about all the keyboard shortcuts available on a given page by hitting “Shift + ?”

Make sure you click “show all” for additional shortcuts, including my favorite shortcut: the ‘t’ key:

Task Lists

You can create task lists in pull requests with markdown like the following:

- [ ] Tests for validation
- [x] Tests for unauthorized access
- [ ] Add indexes to migrations

Which will render as the following in your pull request:

You can check the boxes too once you save the description of a pull request, and you can edit the description to add more todos and manage complete vs. incomplete.

As a bonus, they show up as todo’s on the master list of PRs:

Todos might be something experienced GitHub users are familiar with, but I find that new GitHub users are blown away by this somewhat hidden feature. I use it to communicate that the pull request is still a work-in-progress, and what is still outstanding.

Hub CLI Tool

Hub is a command-line wrapper for git for working with GitHub. You can choose to alias git to hub, or use it as a stand-alone (I prefer the latter):

alias git=hub

With hub you can quickly clone and fork repositories:

hub clone laravel/framework
-> git clone git://
hub fork

In a GitHub project, you can browse the issues with the hub browse command:

hub browse -- issues
# or a specific project
hub browse laravel/framework issues
hub browse laravel/framework wiki
hub browse laravel/framework pulls

And my favorite hub command is creating a pull request from the command line, which gives you a git commit-like experience and finally outputs the PR link after creating the pull request:

hub pull-request
# check for help info
hub pull-request --help

Check out hub on for install instructions and more examples.

More Tips

Do you have some GitHub tips you love? Reply to Laravel News on Twitter and share your tips with @laravelnews.

Paul Redmond photo

Staff writer at Laravel News. Full stack web developer and author.

Filed in:

Laravel Newsletter

Join 40k+ other developers and never miss out on new tips, tutorials, and more.

Laravel Forge logo

Laravel Forge

Easily create and manage your servers and deploy your Laravel applications in seconds.

Laravel Forge
Tinkerwell logo


The must-have code runner for Laravel developers. Tinker with AI, autocompletion and instant feedback on local and production environments.

No Compromises logo

No Compromises

Joel and Aaron, the two seasoned devs from the No Compromises podcast, are now available to hire for your Laravel project. ⬧ Flat rate of $7500/mo. ⬧ No lengthy sales process. ⬧ No contracts. ⬧ 100% money back guarantee.

No Compromises
Kirschbaum logo


Providing innovation and stability to ensure your web application succeeds.

Shift logo


Running an old Laravel version? Instant, automated Laravel upgrades and code modernization to keep your applications fresh.

Bacancy logo


Supercharge your project with a seasoned Laravel developer with 4-6 years of experience for just $2500/month. Get 160 hours of dedicated expertise & a risk-free 15-day trial. Schedule a call now!

Lucky Media logo

Lucky Media

Get Lucky Now - the ideal choice for Laravel Development, with over a decade of experience!

Lucky Media
Lunar: Laravel E-Commerce logo

Lunar: Laravel E-Commerce

E-Commerce for Laravel. An open-source package that brings the power of modern headless e-commerce functionality to Laravel.

Lunar: Laravel E-Commerce
LaraJobs logo


The official Laravel job board

SaaSykit: Laravel SaaS Starter Kit logo

SaaSykit: Laravel SaaS Starter Kit

SaaSykit is a Laravel SaaS Starter Kit that comes with all features required to run a modern SaaS. Payments, Beautiful Checkout, Admin Panel, User dashboard, Auth, Ready Components, Stats, Blog, Docs and more.

SaaSykit: Laravel SaaS Starter Kit
Rector logo


Your partner for seamless Laravel upgrades, cutting costs, and accelerating innovation for successful companies

MongoDB logo


Enhance your PHP applications with the powerful integration of MongoDB and Laravel, empowering developers to build applications with ease and efficiency. Support transactional, search, analytics and mobile use cases while using the familiar Eloquent APIs. Discover how MongoDB's flexible, modern database can transform your Laravel applications.


The latest

View all →
Learn to master Query Scopes in Laravel image

Learn to master Query Scopes in Laravel

Read article
How to Redirect Uppercase URLs to Lowercase with Laravel Middleware image

How to Redirect Uppercase URLs to Lowercase with Laravel Middleware

Read article
Generics Added to Eloquent Builder in Laravel 11.15 image

Generics Added to Eloquent Builder in Laravel 11.15

Read article
Manage Roles and Permissions in Filament with Hex Lite image

Manage Roles and Permissions in Filament with Hex Lite

Read article
Laravel Rest Api now supports Laravel Scout image

Laravel Rest Api now supports Laravel Scout

Read article
Build Your SaaS App in Days with SaaSykit image

Build Your SaaS App in Days with SaaSykit

Read article