【ZZ】号称“开发者神器”的GitHub,到底该怎么用?
号称“开发者神器”的GitHub,到底该怎么用?
https://mp.weixin.qq.com/s/zpKOBMKWckY05Mv_B28RgQ
A developer’s introduction to GitHub – freeCodeCamp
https://medium.freecodecamp.org/a-developers-introduction-to-github-1034fa55c0db
A developer’s introduction to GitHub
GitHub is a website that hosts billions of lines of code, and it’s where millions of developers gather every day to collaborate on and report issues with open source software.
In short, it’s a platform for software developers, and it’s built around Git.
TIP: If you don’t know about Git yet, checkout my Git guide.
As a developer, you can’t avoid using GitHub or another Git-based tool on a daily basis as part of your work. It’s used to either host your code or to collaborate on other people’s code. This article explains some key concepts of GitHub, and how to use some of its features to improve your workflow.
Why GitHub?
Now that you know what GitHub is, you might ask why you should use it.
GitHub, after all, is managed by a private company, which profits from hosting people’s code. So why should you use that instead of similar platforms such as BitBucket or GitLab?
Beside personal preferences, and technical reasons, there is one big reason: everyone uses GitHub, so the network effect is huge.
Major codebases have migrated over time from other version control systems to Git because of its convenience, and GitHub has been historically well positioned and put in a lot of effort to serve the needs of the Open Source community.
So today, any time you look up some library, you will 99% of the time find it on GitHub.
Apart from Open Source code, many developers also host private repositories on GitHub because of the convenience of the platform.
Now lets get started on the important Git specific concepts that a developer needs to know.
GitHub Issues
GitHub issues are one of the most popular bug trackers in the world.
They provide the owners of a repository the ability to organize, tag, and associate issues to milestones.
If you open an issue on a project managed by someone else, it will stay open until either you close it (for example if you figure out the problem you had) or the repo owner closes it.
Sometimes you’ll get a definitive answer, and at other times the issue will be left open and tagged with some information that categorizes it. Then the developer can get back to it to fix the problem or improve the codebase with your feedback.
Most developers are not paid to support their code released on GitHub, so you can’t expect prompt replies. But some open source repositories are published by companies that provide services around that code, have commercial offerings for versions with more features, or utilize a plugin-based architecture. And so they have paid developers working on the open source project.
Social coding
Image credit: https://octodex.github.com
A few years ago, the GitHub logo included the “social coding” tagline.
What did this mean, and is that still relevant? It certainly is.
Follow
With GitHub you can follow a developer or a repository by going to the user’s profile and clicking “follow,” or by clicking the “watch” button on a repo.
In both cases, the activity will show up in your dashboard. Following a user or repository is unlike Twitter, where you see what people say — instead you see what people do.
Stars
One big feature of GitHub is the ability to star a repository. This action will include it in your “starred repositories” list, which allows you to keep track of projects you find interesting and discover similar projects.
It’s also one of the most important rating mechanisms, as the more stars a repo has, the more popular and important it generally is. This results in it showing up more prominently in search results.
Major projects can have tens of thousands of stars.
GitHub also has a trending page where it features the repositories that get the most stars in a determined period of time (for example, today or this week or this month).
Getting into those trending lists can cause other network effects like being featured on other sites, just because you have more visibility.
Fork
The last important network indicator of a project is the number of forks.
This is key to how GitHub works, as a fork is the base of a Pull Request (PR), which is a change proposal. A person may fork your repository, make some changes, and then create a pull request to ask you to merge those changes.
Sometimes the person that forks a repository may never ask you to merge anything. They may fork your repository just because they liked your code and decided to add something on top of it which they don’t want to merge back into the original repository. A user may also fix a bug they were experiencing which was specific to them.
Popular = better
All in all, those are all key indicators of the popularity of a project. Apart from the above indicators, the date of the latest commit and the involvement of the author in the issues tracker are useful indications of whether or not you should rely on a library or software.
Pull requests
In the previous section I introduced what a Pull Request (PR) is. To reiterate, a person may fork your repository, makes some changes, and then create a pull request to ask you to merge those changes.
A project might have hundreds of PRs, and it’s generally the case that the more popular a project, the more PRs it has, like the React project:
Once a person submits a pull request, it needs to be reviewed by the core maintainers of the project.
Depending on the scope of your pull request (the number of changes, the number of things affected by your change, or the complexity of the code touched) the maintainer might need more or less time to make sure your changes are compatible with the project.
A project might have a clear timeline of changes they want to introduce. The maintainer might like to keep things simple while you are introducing a complex architecture in a pull request.
This is to say that a pull request does not always get accepted quickly, and there is no guarantee that the pull request will ever get accepted.
In the example I posted above, there is a pull request in the repo that dates back to 1.5 years ago. And this happens in all projects — it’s quite normal and may be due to the reasons I mentioned above.
Project management
Along with issues, which are the places where developers get feedback from users, the GitHub interface offers other features aimed at providing a few project management features.
One of those is Projects. It’s very new in the ecosystem and very rarely used, but it’s a Kanban board that helps organize issues and work that needs to be done.
The Wiki is intended to be used as a documentation for users. One of the most impressive uses of the Wiki I’ve seen up to now is the Go Programming Language GitHub Wiki.
Another popular project management aid is milestones. It’s part of the issues page, and you can assign issues to specific milestones, which could be release targets.
Speaking of releases, GitHub enhanced the Git tag functionality by introducing releases.
A Git tag is a pointer to a specific commit, and if done consistently, it helps you roll back to previous version of your code without referencing specific commits.
A GitHub release builds on top of Git tags and represents a complete release of your code, along with Zip files, release notes, and binary assets that might represent a fully working version of your code’s end product.
While a Git tag can be created programmatically (for example, using the command line git
program), creating a GitHub release is a manual process that happens through the GitHub UI. You basically tell GitHub to create a new release and tell them which tag you want to apply that release to.
Comparing commits
GitHub offers many tools to work with your code.
One of the most important things you might want to do is compare one branch to another one. Or you might want to compare the latest commit with the version you are currently using to see which changes were made over time.
GitHub allows you to do this with the compare view: just add /compare
to the end of the repo name.
For example, https://github.com/facebook/react/compare
In the figure below, I compare the latest React v15.x to the latest v16.0.0-rcversion available at the time of this writing to see what’s changed.
This view shows you the commits made between two releases (or tags or commits references) that were changed, and the actual diff, if the number of changes is lower than a reasonable amount.
Webhooks and Services
GitHub offers many features that help the developer workflow, such as webhooks and services.
Webhooks
Webhooks allow external services to be pinged when certain events happen in the repository, for example when code is pushed, a fork is made, or a tag was created or deleted.
When an event happens, GitHub sends a POST request to the URL we tell it to use.
A common usage of this feature is to ping a remote server to fetch the latest code from GitHub when we push an update from our local computer.
We push to GitHub, GitHub tells the server we pushed, and the server pulls from GitHub.
Services
GitHub services, and the new GitHub apps, are 3rd party integrations that improve the developer experience or provide a service to you.
For example, you can setup a test runner to run the tests automatically every time you push some new commits, using TravisCI.
You can setup Continuous Integration using CircleCI.
You might create a Codeclimate integration that analyzes the code and provides a report of “Technical Debt” and test coverage.
Final words
GitHub is an amazing tool and service to take advantage of, a real gem in today’s developer toolset. This tutorial will help you get started, but the real experience of working on GitHub open source (or closed source) projects is something not to be missed.
Thanks for reading through this tutorial. There’s a lot to learn about the new Browser APIs. I publish a lot of related content on my blog about frontend development. Don’t miss it!
【ZZ】号称“开发者神器”的GitHub,到底该怎么用?的更多相关文章
- 被称为“开发者神器”的GitHub,到底该怎么用?
被称为“开发者神器”的GitHub,到底该怎么用? 原文:https://baijiahao.baidu.com/s?id=1594232691312740966&wfr=spider& ...
- 五年 Web 开发者 star 的 github 整理说明
欢迎大家前往腾讯云技术社区,获取更多腾讯海量技术实践干货哦~ 作者:樊东东 前端从业几年,积累了不少github开源库. 有时候想查阅以前star的库,但不好找,github大多库都是英文说明,对中文 ...
- windows 开发者神器 tc – total command和替代品
作为开发者,windows上开发时,会运用一些神器,比如:total commander,搜索目录.查看文件.批量重命名等非常方便. tc是收费版的,有个免费的替代版本Just manager:htt ...
- 一年一度!GitHub 开发者大会「GitHub 热点速递 v.22.45」
GitHub 是全球最大的开源社区,它的一举一动都深受每一位开源爱好者的关注.这周末刚落下帷幕的<GitHub Universe 2022>是 GitHub 发布最新产品.功能.报告和计划 ...
- Git与GitHub到底有什么联系?
Git与GitHub区别 git 是一个软件 版本控制器 分享合并代码, 团队开发 时间机器, 可以获取到任意阶段时间节点开发的代码, 代码找回 git, cvs, bitkeeper, svn 典型 ...
- Android开发者的Git&GitHub(二)
将代码托管到GitHub上 点击右上角New repository按钮来创建一个版本库 命名后选择添加一个Android项目类型的.gitignore文件,并选择开源协议(例如:Apache v2 ...
- Android开发者的Git&Github(一)
安装Git: Linux(以Ubuntu为例): sudo apt-get install git-core Windows: 访问网址http://msysgit.github.io/下载安装包 下 ...
- octotree神器 For Github and GitLab 火狐插件
Code tree for GitHub and GitLabExtension to show code tree for GitHub and GitLab. Useful for develop ...
- 开发者神器!Windows上最强大的虚拟桌面工具-Dexpot
简介 : 用过Linux和Mac计算机的人都知道 , 这两个系统上都有个多桌面的功能非常使用 . 而在Windows上并没有该项功能 , 虽然目前Win10已经增加了多桌面的程序 , 但使用上仍体验不 ...
随机推荐
- 04 jsp,EL,JSTL
jsp:Java Server Page 什么是jsp?从用户角度看待 ,就是是一个网页 , 从程序员角度看待 , 其实是一个java类, 它继承了servlet,所以可以直接说jsp 就是一个Se ...
- MongoDB高可用集群搭建(主从、分片、路由、安全验证)
目录 一.环境准备 1.部署图 2.模块介绍 3.服务器准备 二.环境变量 1.准备三台集群 2.安装解压 3.配置环境变量 三.集群搭建 1.新建配置目录 2.修改配置文件 3.分发其他节点 4.批 ...
- 【添加最新版本的mysql的jdbc连接jar包】java.math.BigInteger cannot be cast to java.lang.Long异常
[问题描述] 从我的电脑把项目拷贝到guo小中的win8电脑,but出现了那个错误,估计他的mysql是最新版本的. [如何下载连接jar包] 链接:https://pan.baidu.com/s/1 ...
- mysql将某数据库的全部权限赋给某用户,提示1044错误Access denied
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix'; ERROR 1044 (4 ...
- MySQL Innodb Engine --独立表空间参数(innodb_file_per_table)
MySQL中参数innodb_file_per_table决定将表存放于ibdata*的共享表空间还是独立的.ibd文件的独立表空间. ================================ ...
- ORM 创建manytomay的三种方法 反向查询 和一些 双下方法版学员管理系统3
老师信息管理 三种创建多对对外键的方式常用第二种和第三种 思考 三种方式创建多对多外键方式及其优缺点. 外键的查询和使用 1外键的创建: 在数据库表中的表现形式 如何连表查询和使用 表里边: s ...
- showdoc 开源在线api&&技术文档管理工具
showdoc 是一个很不错的api 以及技术文档管理工具 环境准备 doker-copose 文件 version: "3" services: doc: image: regi ...
- 【VBA研究】VBA自己定义函数參数类型不符的错误
版权声明:本文为博主原创文章.未经博主同意不得转载. https://blog.csdn.net/iamlaosong/article/details/36871769 作者:iamlaosong 1 ...
- mysql之 事务prepare 与 commit 阶段分析
打开binlog选项后,执行事务提交命令时,就会进入两阶段提交模式.两阶段提交分为prepare阶段和commit两个阶段.流程如下 :这里面涉及到两个重要的参数:innodb_flush_log_a ...
- oracle之 如何 dump logfile
这篇文章解释了如何在联机或归档重做日志文件中获取转储. 约束和限制:1.数据库必须安装(或打开).更改系统转储日志文件与任何实例无关,因此不需要为其操作安装数据库.但是,在ALTER SYSTEM D ...