Introduction to GitHub Developers

GitHub is a website where millions of developers gather every day to collaborate on open source software. It's also a place where billions of lines of code are hosted, and it's also a place where software users report problems they might encounter. Learn all the most important parts of GitHub that developers should know

Introduction to GitHub

GitHub is a website where millions of developers gather every day to collaborate on open source software. It's also a place where billions of lines of code are hosted, and it's also a place where software users report problems they might encounter.

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

Tip: If you don’t know Git yet, please checkGit guide.

As a developerYou can't avoid using GitHub every dayTo host your code or use someone else’s code. This article introduces you to some key concepts of GitHub, how to use some of its features to improve your workflow, and how to integrate other applications into your process.

Why choose GitHub?

Now you know about GitHubYes, You may askwhyYou should use it.

After all, GitHub is managed by a private company that makes money from the custodian’s code. So, why not use a similar platform (such as BitBucket or GitLab)?

In addition to personal preferences and technical reasons, there is another important reason: everyone uses GitHub, so the network impact is huge.

Over time, the main code base migrated from other version control systems to Git because of its convenience, and GitHub has historically been well positioned in the Open Source community (and put a lot of effort to "win") .

Therefore, whenever you look for a library today, you will find it on GitHub 99% of the time.

In addition to open source, many developers also host private repositories on GitHub due to the convenience of the unique platform.

GitHub issues

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

It provides the owner of the repository with the ability to organize, mark and assign milestone events.

If you open an issue in a project managed by someone else, the issue will remain open until you close it (for example, if you find a problem) or the repo owner closes it.

Sometimes, you will get a clear answer, sometimes, the question will be unresolved, with some information to classify the problem, the developer can solve the problem or improve the code base based on the feedback of the problem.

Most developers don’t need to pay to support the code they publish on GitHub, so you won’t expect a quick response, but other times, open source code repositories are provided by providing services around that code or targeting more features The version is released by a company that provides a commercial product, or a plug-in-based architecture, in which case they may work on open source software as a paid developer.

Social coding

A few years ago, the GitHub logo contained the slogan "Social Coding."

What does this mean and does it still make sense? It must be.

follow

Use GitHubYou can follow the developers, Just go to their profile and click "Follow".

You can also follow the repository, By clicking "WatchThe "" button on the warehouse.

In both cases, the activity will be displayed in your dashboard. You don’t follow people like you do on Twitter, and you can see what people say on Twitter, butWhat do you see people doing.

star

A great feat of GitHub is the ability toStar the database. This action will include it in the list of "starred repositories", allowing you to find interesting content previously discovered, and it is also one of the most important rating mechanisms, because the more stars in the repurchase agreement, The more important it is, and the more it will show up in search results.

Large projects can have 70.000 or more stars.

GitHub also has oneTrend pageIt is characterized by the repository with the most stars in a certain period of time (such as today, this week or this month).

Entering these trend lists may cause other network effects, such as being displayed on other sites, simply because you have higher visibility.

cross

The last important network indicator of the project is the number of forks.

This is the key to the way GitHub works, because derivation is the basis of a pull request. Start with your repository, someone forks it, makes some changes, and then creates a PR to ask you to merge those changes.

Sometimes the person who forked never asks you to merge anything, simply because they like your code and decide to add something on top of it, or they fix the bug they encountered.

Fork will clone the files of the GitHub project, but will not clone any asterisks or issues of the original project.

All in all, these are key indicators of the popularity of the project, and usually together with the date of the most recent submission and the author’s participation in the issue tracker, are a useful indicator of whether you should rely on the project. Library or software.

Pull request

Before introducing what is a pull request (PR)

Start with your repository, someone forks it, makes some changes, and then creates a PR to ask you to merge those changes.

A project may have hundreds of PRs. Generally speaking, the more popular the project, the more PRs. For example, the React project:

React Pull Requests

Once a person submits a PR using the GitHub interface, it is a simple process that requires the core maintainer of the project to review it.

depending onrangeFor your PR (the number of changes, or the number of things affected by the changes, or the complexity of the code touched), the maintainer may need more or less time to ensure that your changes are compatible with the project.

A project may have a clear timetable and they want to introduce changes. When you introduce complex architectures in PR, maintainers may want to keep things simple.

that isDon’t always accept PR quickly,andThere is no guarantee that the PR will even be accepted.

In the example I posted above, there is a PR in the repo that dates back 1.5 years. And this happened onAllproject.

project management

In addition to issues (where developers get feedback from users), the GitHub interface also provides other features designed to help project management.

One of them isProject. It’s very new in the ecosystem and rarely used, but it’s aKanbanHelp organize problems and work that needs to be done.

Thishref="WikipediaIntended to be used as user documentation. One of the most impressive uses of the Wiki I have seen so far isGo to the programming language GitHub Wiki.

Another popular project management help ismilestone. In a part of the issue page, you can assign issues to specific milestones, which can be used as release targets.

Speaking of release, GitHub has enhancedGit tagsBy introducing featuresrelease.

Git tags are pointers to specific commits, and if executed consistently, they can help you roll back to the previous version of the code without referencing a specific commit.

The GitHub release is built on Git tags, which represents the complete release of your code, as well as zip files, release notes, and binary assets (which may represent the complete version of the final product of your code).

Although Git tags can be created programmatically (for example, using the command line)gitProgram), creating a GitHub version is a manual process through the GitHub UI. You basically tell GitHub to create a new version and tell them which tag to apply that version to.

Compare submission

GitHub provides many tools to process your code.

One of the most important things you might want to do is to compare one branch to another. Or, compare the latest commit with the version currently in use to understand what changes have been made over time.

GitHub allows you to useComparison view, Just add/compareThe name of the repo, for example:https://github.com/facebook/react/compare

Compare View

For example, here I choose the most up-to-dateReaction v15.xTo the latestv16.0.0-rcVersions available at the time of writing to check for changes:

Compare React Versions

This view shows youPromise madeBetween two versions (or mark or submit for citation)Actual difference,If the number of changes is less than a reasonable amount.

Webhooks and services

GitHub provides many features that help developers' workflow. One of them is webhooks and the other is service.

Network hook

When certain events occur in the repository, such as when pushing code, creating forks, creating or deleting tags, Webhooks allow pinging of external services.

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

The common usage of this feature is when we push updates from the local computer, ping the remote server to get the latest code from GitHub.

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

service

The GitHub service and the new GitHub application are third-party integrations that can improve the developer experience or provide services to you.

For example, you can set up a test runner to automatically run the test every time you push some new commits, useTravisCI.

You can set up continuous integration in the following waysCircleCI.

You can create aCode climateIntegration to analyze code and provide reports on technical debt and test coverage.

Final words

GitHub is an amazing tool and service that can be used, and it is a true gem in today's developer toolset. This tutorial will help you get started, but don’t miss the real experience of working on GitHub (open source (or closed source) project).


More git tutorials: