开源日报 每天推荐一个 GitHub 优质开源项目和一篇精选英文科技或编程文章原文,坚持阅读《开源日报》,保持每日学习的好习惯。
今日推荐开源项目:《简单调试 vscode-browser-preview》
今日推荐英文原文:《How to be more productive on GitHub》
2019年1月25日:开源日报第323期
今日推荐开源项目:《简单调试 vscode-browser-preview》传送门:GitHub链接
推荐理由:使用 vscode 来编写网页的朋友们绝对会想要看看这个的,这个项目可以在你的 vscode 界面上张开一个浏览器让你实时浏览你写的网页效果。这样你就不再需要对着你的 html 在浏览器中打开然后看看效果了,只需要使用这个项目就能够看到网页的整体效果,如果经常需要在 vscode 上编写网页的话兴许这会带来相当大的便利之处。

今日推荐英文原文:《How to be more productive on GitHub》作者:Darren Burns
原文链接:https://medium.freecodecamp.org/how-to-be-more-productive-on-github-c3cedab043e3
推荐理由:如何使用 GitHub 上的一些功能提高生产效率

How to be more productive on GitHub

With the recent announcement by GitHub of unlimited private repositories, let’s take a few minutes before we push our code we don’t want anyone else to see to the cloud, 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, it’s 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.

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 multi-line Markdown snippet and add the tag “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!

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.

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.

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 safely in the knowledge 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!

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. 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: 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!
下载开源日报APP:https://openingsource.org/2579/
加入我们:https://openingsource.org/about/join/
关注我们:https://openingsource.org/about/love/