DEV Community

Cover image for 8 Productivity Tips for GitHub
Darren Burns
Darren Burns

Posted on • Updated on

8 Productivity Tips for GitHub

With the recent announcement of unlimited private repositories, let's take a few minutes before we push up the code we don’t want anyone else to see, and make sure we’re making the most of what GitHub has to offer.

GitHub is built with some extremely helpful shortcuts and productivity-boosting features. From personal experience, however, it’s clear that these often fall under the radar amongst developers. If I’ve ever witnessed a specific GitHub feature surprise or assist someone, then that feature is on this page. That said, what follows is by no means an exhaustive list.

Quick fuzzy file search in repositories

This is, without doubt, the fastest way to browse a repository when you know what you’re looking for. Open up any repository and press t. You can now search for the name of any file in the repository, and use the arrow keys on your keyboard to move through the results. Press Enter to open the file.

github-fuzzy-search

Code change suggestions in pull requests

When commenting on a piece of code in a pull request, you can suggest alternative code using the “Suggested Changes” feature. The author of the pull request will be able to apply your suggestion instantly without leaving GitHub.

To make the suggestion, surround a code snippet with a multiline Markdown snippet, with the tag suggestion:

gh-make-suggestion

Now that you’ve made the suggestion, the author of the pull request can immediately apply it to their branch, without the hassle of manually changing the file!

gh-apply-suggestion

Navigate the code tree like in an IDE

This one requires an unofficial Chrome extension, but it’s a slightly more familiar way to navigate your code compared to the default interface. The Octotree extension lets you browse GitHub repositories with a sidebar tree view similar to what you get in applications like VS Code.

octotree

Jump to a function when reviewing code

Unless you’re reviewing a single function, a code review often involves a lot of jumping between function calls and their definitions (and therefore a lot of scrolling up and down). GitHub lets you jump to a symbol by pressing t when you’re looking at files in a pull request.

gh-jump-to-symbol

Creating a permalink to a file

When viewing a file or directory, press y, and the URL will be converted to a permalink, which you can share knowing that the contents of the file will never change.

If you send a link to a file or directory on GitHub without making it into a permalink, you’ll need to accept the possibility that the file could disappear tomorrow, breaking the link!

Viewing the blame and change recency heatmap

When viewing a file, you can press b to view the Git blame and a heatmap showing how recently each line was changed. It’ll tell you who most recently changed each line of code, and give you a clickable link taking you to the full commit the change was part of.

On the right-hand side of the gutter (which contains the commit message and author), you’ll notice an orange vertical bar. The more vivid this bar is, the more recent the change, meaning you can easily scan the file to find the freshest code!

gh-blame

Powerful code search

GitHub indexes most code and offers powerful search functionality over it. If you need to find something in a repository, but don’t plan on making any changes to it. There’s usually no need to check the repository out. Press / to search all the code in the repository.

gh-code-search

If your search contains multiple words and you want to search for occurrences of your specific search query, put the quotations around the query. You can filter your searches by other things too, such as file size, extension, the path the file is on, and much more.

Saved replies

If you ever find yourself repeating the same comments, you’ll save some time by creating a saved reply. The next time you find you’re going to type that comment again, you can instead just select it from a drop-down menu:

gh-saved-replies

To perform the above action without using my mouse, I can do ctrl + . followed by ctrl + 1.

Conclusion

Thanks for reading. I hope you found at least one thing on this page that will make you a more productive GitHub user. If you enjoyed this post or have any feedback in general, let me know!

If you’re interested in more content like this, follow my Twitter.

Originally published on my blog.

P.S. You can make your own Octocat for sharing like the one in the cover photo at myoctocat.com!

Latest comments (59)

Collapse
 
tkayos profile image
Margarett

You know, this is actually a very interesting topic for conversation.

Collapse
 
codewithgauri profile image
gaurav pandey

Great you can also check this out : blog.codewithgauri.tech/blog/how-t...

Collapse
 
cpinkus profile image
Claudio Pinkus

Thanks Darren for the tips. I would like to know if you checked CodeStream, our IDE extension for VS Code, Visual Studio and Jetbrains editors that does some of these things and also includes PRs in your IDE with the ability to add comments on any line of code, not only what's changed. Would love your feedback!

Collapse
 
cpinkus profile image
Claudio Pinkus

Thanks @_darrenburns for this! Have you checked the CodeStream extension for VS Code, VS and Jetbrains? (Disclaimer - I work there). Would love to get your impression.

Collapse
 
ashchk profile image
Ashis Chakraborty

Good tips...liked it

Collapse
 
pda_code profile image
Takis Antonopoulos
Collapse
 
gruser profile image
GruSer

Thanks for the interesting information...

Collapse
 
lelethebest profile image
Emanuele

Cool post, thanks :)

Collapse
 
afifalfiano profile image
Afif Alfiano

Thank you

Collapse
 
robertcoopercode profile image
Robert Cooper

This article is absolute gold. Will definitely be using the t keyboard shortcut to search for files.

Collapse
 
_darrenburns profile image
Darren Burns

Thank you so much 🙂

Collapse
 
thorstenhirsch profile image
Thorsten Hirsch

Press ? to see the available keyboard shortcuts.

Collapse
 
tcelestino profile image
Tiago Celestino

I did know about "suggestions" and "saved replies", they are amazing.

I recommend also the Refined GitHub.

Thanks for tips!

Collapse
 
kylegalbraith profile image
Kyle Galbraith

Great post Darren! I use a few these in my day to day.

Collapse
 
tcrammond profile image
Tyler Crammond

Great tips, I didn't know about the search hotkeys at all. Thanks

Some comments may only be visible to logged-in visitors. Sign in to view all comments.