号称“开发者神器”的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,到底该怎么用?的更多相关文章

  1. 被称为“开发者神器”的GitHub,到底该怎么用?

    被称为“开发者神器”的GitHub,到底该怎么用? 原文:https://baijiahao.baidu.com/s?id=1594232691312740966&wfr=spider& ...

  2. 五年 Web 开发者 star 的 github 整理说明

    欢迎大家前往腾讯云技术社区,获取更多腾讯海量技术实践干货哦~ 作者:樊东东 前端从业几年,积累了不少github开源库. 有时候想查阅以前star的库,但不好找,github大多库都是英文说明,对中文 ...

  3. windows 开发者神器 tc – total command和替代品

    作为开发者,windows上开发时,会运用一些神器,比如:total commander,搜索目录.查看文件.批量重命名等非常方便. tc是收费版的,有个免费的替代版本Just manager:htt ...

  4. 一年一度!GitHub 开发者大会「GitHub 热点速递 v.22.45」

    GitHub 是全球最大的开源社区,它的一举一动都深受每一位开源爱好者的关注.这周末刚落下帷幕的<GitHub Universe 2022>是 GitHub 发布最新产品.功能.报告和计划 ...

  5. Git与GitHub到底有什么联系?

    Git与GitHub区别 git 是一个软件 版本控制器 分享合并代码, 团队开发 时间机器, 可以获取到任意阶段时间节点开发的代码, 代码找回 git, cvs, bitkeeper, svn 典型 ...

  6. Android开发者的Git&GitHub(二)

     将代码托管到GitHub上 点击右上角New repository按钮来创建一个版本库 命名后选择添加一个Android项目类型的.gitignore文件,并选择开源协议(例如:Apache v2 ...

  7. Android开发者的Git&Github(一)

    安装Git: Linux(以Ubuntu为例): sudo apt-get install git-core Windows: 访问网址http://msysgit.github.io/下载安装包 下 ...

  8. octotree神器 For Github and GitLab 火狐插件

    Code tree for GitHub and GitLabExtension to show code tree for GitHub and GitLab. Useful for develop ...

  9. 开发者神器!Windows上最强大的虚拟桌面工具-Dexpot

    简介 : 用过Linux和Mac计算机的人都知道 , 这两个系统上都有个多桌面的功能非常使用 . 而在Windows上并没有该项功能 , 虽然目前Win10已经增加了多桌面的程序 , 但使用上仍体验不 ...

随机推荐

  1. C++学习(一)之Visual Studio安装以及首次使用

    一.安装Visual Studio 首先下载Visual Studio 链接: http://pan.baidu.com/s/1pLhJt0Z 密码:uqyc 将.ios文件解压得到以下文件: 点击v ...

  2. hdu3488 Tour 拆点+二分图最佳匹配

    In the kingdom of Henryy, there are N (2 <= N <= 200) cities, with M (M <= 30000) one-way r ...

  3. CH#46A 磁力块

    题意 磁力块 CH Round #46 - 「Adera 8」杯NOI模拟赛 描述 在一片广袤无垠的原野上,散落着N块磁石.每个磁石的性质可以用一个五元组(x,y,m,p,r)描述,其中x,y表示其坐 ...

  4. day 55 jQuery 之事件 绑定等

    属性选择器: [attribute] [attribute=value]// 属性等于 列入 $("input[value='male']").prop('chekced') 注意 ...

  5. Tensorflow 笔记

    TensorFlow笔记-08-过拟合,正则化,matplotlib 区分红蓝点 TensorFlow笔记-07-神经网络优化-学习率,滑动平均 TensorFlow笔记-06-神经网络优化-损失函数 ...

  6. phpstorm 2017激活码(方法)

    JetBrains激活 JetBrains 授权服务器(License Server URL):http://idea.imsxm.com 使用方法:激活时选择License server 填入htt ...

  7. Spring MVC里面xss攻击的预防

    关于xss的介绍可以看 Asp.net安全架构之1:xss(跨站脚本)和 腾讯微博的XSS攻击漏洞 网页, 具体我就讲讲Spring MVC里面的预防: 第一种方法,使用Spring MVC web. ...

  8. 100M双绞线接头的标准接法

     双绞线接头(RJ45)针脚号码定义

  9. 阅读OReilly.Web.Scraping.with.Python.2015.6笔记---找出网页中所有的href

    阅读OReilly.Web.Scraping.with.Python.2015.6笔记---找出网页中所有的href 1.查找以<a>开头的所有文本,然后判断href是否在<a> ...

  10. TStrings与Memo.Lines赋值的问题

    //想实现在函数中生成Memo1的内容,而后赋给Memo.Lines //方法1: var s: TStrings; begin s := TStringList.Create; AddMemoDat ...