Boost GitHub Productivity: Tips for Newbies and More
From the translator: we publish for you an article by Darren Barnes , who shares his experience with GitHub. His advice will be useful, first of all, for beginners. Perhaps an experienced coder will find something for himself.
GitHub is an excellent service, which many, if not all, programmers use. After the volume of private repositories became unlimited , the service attracted the attention of even those who had not worked with it before.
The service was developed by programmers for programmers. Its creators have added a large number of very handy tools that increase productivity. But, unfortunately, not all developers know about these tools. And who knows - does not always use.
Skillbox recommends: A two-year hands-on course “I am a PRO web developer . ”
We remind: for all readers of "Habr" - a discount of 10,000 rubles when writing to any Skillbox course on the promotional code "Habr".
Quick file search in repositories
This is one of the fastest file search methods — only when you know what you are looking for. Open any repository and press "t". Now you can search for files by name, for convenience, using the keyboard direction buttons. To open a file, press Enter.
Pull request, suggestions for changing the code
For pull request provides a great feature Suggested Changes. If you make a suggestion, the author of the code, deciding to accept your edit, can do it by pressing a button, without leaving GitHub. In order to make your offer, you need to wrap the snippet with the markdown snippet code and select the suggestion tag.
But how can the proposed change be made by the author of the code? However, he does not need to manually make changes to the file.
Navigating in IDE
It already requires the installation of the Octotree extension for Chrome, but there is nothing difficult here. But we get a more convenient navigation system. By the way, we already wrote about this extension .
Octotree will be especially useful if you study a large-scale project with a large number of nested directories. To get the metadata used GitHub API.
Private repositories are also supported ( instructions for use are here ). GitHub Enterprise is also supported.
Transition to function at code review
Typically, code review involves constant transitions from function calls to their definitions. As a result, you have to constantly scroll back and forth, which is inconvenient. But if you press T, then you do not need to scroll anything, immediately go to the desired place.
Creating a permalink for a file
While browsing a file or directory, just press Y, after which the URL will be converted to a permalink, which you can provide to anyone, knowing that the contents of the file will not change.
If you distribute a regular link, then after the file to which it points will be moved, the link will break.
Git blame and heatmap
When viewing a file, press B - and you will see Git blame and recently modified lines. The tool shows who is the author of the changes, you also get a clickable link with a link to the full commit, some of the changes you are viewing.
Approximately in the middle you see color marks (vertical bar). The brighter the bar, the newer the file. That is, you can see the updated files without any difficulty, without being confused in all its diversity.
Powerful code search
GitHub indexes almost all the code, offering powerful search functionality in the index. If you need to find something in the repository, but you do not want to make changes, then just press / and start searching all over the repository.
If you need to find an element containing several words, simply wrap the phrase in quotes. Actually, this is the standard search method for almost all services. On GitHub, you can search by file extension, size, and other characteristics.
If you do not want to write the same thing from time to time in response to similar comments, create a response template. Instead of scribbling, you can now select the desired template from the drop-down menu.
Even you can not use the mouse, simply using a combination of ctrl + / and ctrl + 1.
GitHub is a great tool, it only gets better over time. Service developers create functions that help users. There are additions created by enthusiasts. To optimize your work, you should get acquainted with at least some of the features offered by GitHub.