No one really likes navigating through the sheer mass of GitHub’s UI when you’re in the middle of a deep dive into a pull request.
Luckily, nearly every page on GitHub has a keyboard shortcut that can turn tedious clicking into lightning-fast efficiency. Some of these commands will make you wonder how you ever lived without them.
Below is a quick roundup of some of the best GitHub keyboard shortcuts that came up during a recent conversation on our dev team’s Slack.
1. Press I
to toggle comments
Tim Heuett learned this shortcut while pairing, and it’s quickly become a favorite. When you’re scanning through a pull request, sometimes the comments are helpful, but other times, they clutter the view.
Press I
to instantly toggle the visibility of comments—keeping you focused on the code when you need to be, and letting you loop back to feedback when it’s time.
Use case: Great for those moments when you’re deep into reviewing a complex diff and just need to cut through the noise to see the code.
2. Press .
to open the repo in VS Code Web
Rian Rainey’s new favorite: If you press .
while on a GitHub repo page, it opens the entire project in VS Code Web. No need to clone the repo or even leave your browser. This trick is a game-changer for those quick edits, or when you just need to dive deeper without the full local environment setup.
Use case: Perfect for when you’re debugging, fixing small typos, or making quick edits in the cloud without the need to spin up VS Code locally.
3. Press t
to open the file finder
Ross Brandes brought up one of the most time-saving features GitHub has to offer. Press t
to open up a file search window. Just start typing and GitHub instantly filters the repo’s file tree to find exactly what you need. This command is so useful, it’s surprising more people don’t know about it.
Use case: Ideal for navigating big repositories with complex file structures when you don’t want to scroll endlessly through directories.
4. Press y
to permalink a file or line in a PR
Joé Dupuis recently discovered y
, and now he can’t go back. When viewing a file, pressing y
updates the URL to a permalinked version, which locks the link to a specific commit. It’s great for sharing exact lines of code that won’t change, no matter how many future commits happen.
Bonus: Follow with a quick Cmd+L
to select the url for quickly copying to clipboard.
Use case: Sharing exact lines or sections of code with your teammates without worrying that changes will mess up your reference.
5. Press ?
to learn all the shortcuts
Jason Karns reminded us that the shortcut that teaches all shortcuts is ?
. When you’re lost or need a refresher, press ?
on any GitHub page to bring up a full list of available keyboard shortcuts. You’ll find everything you need to streamline your workflow.
The shortcut list shown is context-sensitive based on the page you’re viewing, showing only shortcuts relevant to that page. So be sure to try it on multiple areas of the site!
Use case: The go-to move when you want to learn more tricks or need a quick reminder.
6. Press n
and p
to navigate commits of a PR
This one’s a little more niche, but if you’re navigating through a pull request with multiple commits, pressing n
and p
lets you cycle through the commits, moving to the next (n
) or previous (p
) commit in the branch. These are Jason’s most oft-used shortcuts to navigate the history without touching the mouse.
Use case: Reviewing a PR via the commits can oftentimes give a better view of the overall change. These shortcuts help you keep focus without having to click around and lose context.
Bonus: A few more lesser-known GitHub shortcuts
Here are a couple more shortcuts that our team loves but don’t always make the headlines:
- Press
l
to quickly label an issue: This shortcut lets you quickly add labels to an issue without navigating through dropdowns. - Press
s
to focus on the search bar: Instantly brings up the search bar to search through issues, pull requests, or code, no scrolling required. - Press
r
to reply in a thread: When you’re in a PR or issue discussion, r lets you jump right into replying without clicking the comment box. Bonus: Any selected text from another comment will be copied into your reply as a block quote. It’s a great way to be clear about what and who your reply is for. - Press
w
to switch between whitespace and no-whitespace views: This shortcut is a lifesaver when reviewing large diffs where whitespace changes are cluttering the review. Pressingw
toggles the display of whitespace changes, allowing you to focus on actual code modifications.
Your turn
These shortcuts are just the tip of the iceberg. There’s a whole universe of commands out there waiting to speed up your workflow, reduce context-switching, and make GitHub feel like it’s truly working for you.
And hey, if you’re like most of us, you’ve probably discovered a few tricks of your own. So, what’s your go-to GitHub shortcut? Chat with us in the N.E.A.T. community.