GitHub开发人员简介

Interested in learning JavaScript? Get my ebook at jshandbook.com

有兴趣学习JavaScript吗? 在jshandbook.com上获取我的电子书

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.

GitHub是一个拥有数十亿行代码的网站,每天都有数百万开发人员聚集在该网站上,以就开源软件进行协作并报告问题。

In short, it’s a platform for software developers, and it’s built around Git.

简而言之,它是面向软件开发人员的平台,它是围绕Git构建的。

TIP: If you don’t know about Git yet, checkout my Git guide.

提示:如果您还不了解Git,请查看我的Git指南

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.

作为开发人员, 您不可避免地每天要使用GitHub或其他基于Git的工具作为工作的一部分。 它用于托管您的代码或在其他人的代码上进行协作。 本文介绍了GitHub的一些关键概念,以及如何使用其某些功能来改善您的工作流程。

为什么选择GitHub? (Why GitHub?)

Now that you know what GitHub is, you might ask why you should use it.

现在您知道了GitHub是什么,您可能会问为什么要使用它。

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?

毕竟,GitHub是由一家私人公司管理的,该公司从托管人的代码中获利。 那么,为什么要使用它而不是类似的平台(例如BitBucket或GitLab)呢?

Beside personal preferences, and technical reasons, there is one big reason: everyone uses GitHub, so the network effect is huge.

除了个人喜好和技术原因外,还有一个重要原因:每个人都使用GitHub,因此网络影响巨大。

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.

随着时间的推移,主要的代码库已经从其他版本控制系统迁移到Git,这是因为它的便利性,并且GitHub历来处于良好的位置,并付出了很多努力来满足开放源代码社区的需求。

So today, any time you look up some library, you will 99% of the time find it on GitHub.

因此,今天,只要您查找某个库,您就有99%的时间在GitHub上找到它。

Apart from Open Source code, many developers also host private repositories on GitHub because of the convenience of the platform.

除了开源代码外,由于平台的便利性,许多开发人员还在GitHub上托管私有存储库。

Now lets get started on the important Git specific concepts that a developer needs to know.

现在让我们开始开发人员需要知道的重要的Git特定概念。

GitHub问题 (GitHub Issues)

GitHub issues are one of the most popular bug trackers in the world.

GitHub问题是世界上最受欢迎的错误跟踪器之一。

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.

大多数开发人员无需支付支持他们在GitHub上发布的代码的费用,因此您不能期望得到Swift的答复。 但是一些开放源代码存储库是由公司发布的,这些公司围绕该代码提供服务,针对具有更多功能的版本提供商业产品,或者利用基于插件的体系结构。 因此,他们已经为从事开源项目的开发人员付费。

社会编码 (Social coding)

A few years ago, the GitHub logo included the “social coding” tagline.

几年前,GitHub徽标包含“社交编码”标语。

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.

使用GitHub,您可以通过转到用户的个人资料并单击“关注”,或单击存储库上的“监视”按钮来关注开发人员或存储库。

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.

在这两种情况下,活动都会显示在您的仪表板中。 关注用户或存储库与Twitter不同,在Twitter上您可以看到人们在说什么 ,而可以看到人们在做什么

星星 (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.

GitHub的一大特色是能够对存储库加注星标 。 此操作会将其包括在“已加星标的存储库”列表中,使您可以跟踪发现有趣的项目并发现类似的项目。

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).

GitHub也有一个趋势页面 ,其中包含在确定的时间段内(例如今天,本周或本月)获得最多星星的存储库。

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.

这是GitHub工作方式的关键,因为fork是Pull Request(PR)(变更建议)的基础。 一个人可能会分叉您的存储库,进行一些更改,然后创建请求请求以要求您合并这些更改。

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.

有时,派生存储库的人可能永远不会要求您合并任何内容。 他们可能只是因为喜欢您的代码而决定分叉您的存储库,并决定在其之上添加一些不想合并回原始存储库的内容。 用户还可以修复他们遇到的特定于他们的错误。

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.

在上一节中,我介绍了什么是请求请求(PR)。 重申一下,某人可能会分叉您的存储库,进行一些更改,然后创建请求请求以要求您合并这些更改。

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:

一个项目可能有数百个PR,通常情况是,项目越受欢迎,它具有的PR就越多,例如React项目:

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.

在我上面发布的示例中,回购中有一个拉取请求,其历史可以追溯到1.5年前。 这在所有项目中都会发生-这很正常,可能是由于我上面提到的原因。

项目管理 (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.

除了问题(开发人员从用户那里获得反馈的地方)之外,GitHub界面还提供了旨在提供一些项目管理功能的其他功能。

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.

其中之一就是Projects 。 它是生态系统中的新事物,很少使用,但它是一个看板板 ,可帮助组织问题和需要完成的工作。

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.

Wiki旨在用作用户的文档。 我到目前为止所看到的Wiki最令人印象深刻的用途之一就是Go编程语言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.

说到发行版,GitHub通过引入发行版增强了Git标签功能。

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.

Git标记是指向特定提交的指针,如果一致执行,它可以帮助您回滚到以前的代码版本,而无需引用特定的提交。

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.

GitHub版本基于Git标签构建,表示代码的完整版本,以及Zip文件,发行说明和二进制资产(可能表示代码最终产品的完整版本)。

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.

虽然可以通过编程方式(例如,使用命令行git程序)创建Git标签,但是创建GitHub版本是通过GitHub UI进行的手动过程。 您基本上是告诉GitHub创建一个新版本,并告诉他们要将该版本应用于哪个标签。

比较提交 (Comparing commits)

GitHub offers many tools to work with your code.

GitHub提供了许多工具来处理您的代码。

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.

GitHub允许您使用compare视图执行此操作:只需在回购名称的末尾添加/compare即可。

For example, https://github.com/facebook/react/compare

例如, https://github.com/facebook/react/compare

In the figure below, I compare the latest React v15.x to the latest v16.0.0-rc version available at the time of this writing to see what’s changed.

在下图中,我将在撰写本文时将最新的React v15.x与最新的v16.0.0-rc版本进行比较,以了解发生了什么变化。

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和服务 (Webhooks and Services)

GitHub offers many features that help the developer workflow, such as webhooks and services.

GitHub提供了许多有助于开发人员工作流的功能,例如webhooks和服务。

网络挂钩 (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.

当存储库中发生某些事件时,例如当推送代码,创建派生叉或创建或删除标签时,Webhooks允许对外部服务执行ping操作。

When an event happens, GitHub sends a POST request to the URL we tell it to use.

当事件发生时,GitHub将POST请求发送到我们告诉它使用的URL。

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.

此功能的常见用法是,当我们从本地计算机推送更新时,对远程服务器执行ping操作以从GitHub获取最新代码。

We push to GitHub, GitHub tells the server we pushed, and the server pulls from GitHub.

我们推送到GitHub,GitHub告诉我们推送的服务器,然后服务器从GitHub提取。

服务 (Services)

GitHub services, and the new GitHub apps, are 3rd party integrations that improve the developer experience or provide a service to you.

GitHub服务和新的GitHub应用程序是第三方集成,可改善开发人员体验或为您提供服务。

For example, you can setup a test runner to run the tests automatically every time you push some new commits, using TravisCI.

例如,您可以使用TravisCI设置一个测试运行程序,以在每次推送一些新提交时自动运行测试。

You can setup Continuous Integration using CircleCI.

您可以使用CircleCI设置持续集成。

You might create a Codeclimate integration that analyzes the code and provides a report of “Technical Debt” and test coverage.

您可以创建一个Codeclimate集成来分析代码,并提供“技术债务”和测试覆盖率的报告。

最后的话 (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.

GitHub是一个了不起的工具和服务,可以利用,它是当今开发人员工具集中的真正瑰宝。 本教程将帮助您入门,但是在GitHub开放源(或封闭源)项目上工作的真实经验是不容错过的。

Interested in learning JavaScript? Get my ebook at jshandbook.com

有兴趣学习JavaScript吗? 在jshandbook.com上获取我的电子书

翻译自: https://www.freecodecamp.org/news/a-developers-introduction-to-github-1034fa55c0db/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值