What is GitHub? Definition, Functions and How to Use

GitHub is one of the must-have platforms for developers because it offers an easy way to manage code on projects. This platform is quite popular, with more than 56 million users from all over the world.

Well, if you also want to use GitHub, it’s essential first to learn what GitHub is. So it’s easier to manage your project code and use all its features.

In this article, you’ll learn the ins and outs of GitHub. So, let’s watch to the end!

Understanding GitHub

Github interface

GitHub is a website used to store and manage project code. You can generate or upload your code to a GitHub server and then code it online.

This is possible because GitHub is built on two main systems: version control and Git.

Version control is a system that records all code changes to the project. This system is essential to see all the history of code changes.

Meanwhile, Git is a distributed version control that makes code change history accessible to everyone in the project. It’s not just the creator of the code like in ordinary version control.

Git can only be used via the command line, so it is not very friendly for beginners. However, with GitHub, you can use Git through an easy-to-understand user interface (UI).

So, what code can you manage on GitHub? GitHub supports several popular programming languages ​​like C++, Java, PHP, and Python.

Interestingly, you can use GitHub for free to create unlimited projects.

However, if you want additional features such as better security and direct support from the GitHub team, a paid version is also available, with prices starting at $4 per person/month.

Now that you know what GitHub is, it’s time to learn what GitHub does.

What is Git?

Git is a distributed version control system, meaning all codebase and code history will be available on every developer’s computer for easy branching and merging. Git was developed by Linus Torvalds in 2005 and is the core or heart of GitHub.

What is Version Control System?

version control system is a system that records changes made to files so that all of their history is recorded and can be viewed later. When developers create new projects, they continually update the code. Even after the project is online, the developer still has to update the version, fix bugs, add new features, etc.

Version control systems help developers track changes they make to the codebase. Not only that, this system also records who made changes and recovers code that has been deleted or modified.

Since Git keeps multiple copies of the code in the repository, no code is overwritten.

What are Hubs?

If Git is the heart, then the Hub is the soul of GitHub. GitHub’s Hub system turns the command line, like Git, into the largest social media network for developers.

In addition to contributing to specific projects, GitHub allows users to communicate with people who share a common vision and mission. You can even follow them and see the projects they are working on or even find out who they are connected to.

Repository

A repository or repo is a project file storage directory. Here, you can save anything related to your project, such as a code, image, or audio file. Repo is housed in the storage of GitHub or a local repository on your computer.

Branch

The branch is a copy of the repository. You can use an extension when doing development or development separately.

Your work or tasks on a branch will not affect the central repository or other components. When development is complete, you can merge the current branch into another unit and the central repository using a pull request.

Pull Request

A pull request is when you inform the user that you’ve moved the changes you made on the branch to the master repository. The repository collaborator will accept or reject the pull request. Once the pull request is received, you can discuss and review the project with collaborators.

Here are some steps to create a pull request on GitHub:

  1. Go to the repository and look for the brunch menu.
  2. In the branch menu, select the branch where your commits are stored.
  3. Click the New pull request option next to the branch menu.
  4. Enter the title and description of the pull request.
  5. Click the Create pull request option.

Forking Repository

Forking a repository means creating a new project based on an existing repository. In simpler terms, forking a repo means copying an existing repository, making some changes you need, saving the latest version as a new repository, and making it your project.

This feature will improve and enhance the development of your project. Since the forked project is new, everything will be fine in the central repository. You can also apply changes to the master repository in the current forking.

Here are two steps for forking a GitHub repository:

  1. Locate the repository you want to fork.
  2. Click the Fork option.

GitHub Functions

GitHub Code

Here are some GitHub functions for developers:

1. Facilitate Project Collaboration

The primary function of Github is to facilitate collaboration in running projects.

With distributed version control, all developers or team members can access and manage code in one place. For example, conducting joint code reviews, discussing bug fixes, etc.

In addition, GitHub also provides project management features like a Kanban board like Trello. This feature is undoubtedly handy for those with many projects. Because you can more easily determine work priorities, manage workflows , and see project progress.

2. Preventing Code Changes That Could Break the Original Code

Are you afraid that your code changes will break the original code? Don’t worry; GitHub has the solution for you.

You can create “branches” from the project’s main code with the Branch feature. So, you can change the code without affecting the main code directly. Very useful when you want to fix a bug or try to add a new feature.

After you are sure the changes are successful, you can immediately merge the branch into the main code. Practical, right?

3. As a Portfolio for Developers

The last function of GitHub is as a portfolio for developers.

On GitHub, you can set the project or code you’re working on to be publicly displayed. This will demonstrate your abilities as a professional.

That way, potential clients or targeted companies can immediately see your work and contributions to various projects according to your expertise.

How to Use GitHub

Before you start learning how to use GitHub, you need to know some terms that you will often find on GitHub:

Term Explanation
Repository The directory or folder that contains your project’s code change files and history.
Commit A historical record of changes to your files, including who, what, and when the changes occurred.
Clone A a copy of the repository on your computer for offline editing on your device.
fork Copy someone else’s warehouse to your GitHub account. You are usually used to experiment on a project that you find interesting.
Remote Here is the repository version stored on the GitHub server. You can sync with the clone version so offline changes are recorded.
Branch Branch from your central repository. The code you tamper with on the branch will not affect the main repository. So you can freely experiment or fix bugs here.
Merge Merge code that has been changed from one branch to another warehouse. So, after you’ve tested the code on the branch, you can immediately add it to the central repository with a merge.
Pull requests Propose a change to the warehouse to the project owner/leader. Then, he has the right to accept or reject the proposal.
Issue suggestions s, questions, or requests related to the repository. It can be created by your team members or everyone (for public repositories).

Here’s a quick guide on how to use GitHub that you can practice right away:

1. Create a GitHub Account

First, visit the GitHub website at www.github.com, then click Sign Up to create a new account.

Then, enter the required information, such as email, password, and username.

Suppose you want to get the latest GitHub news to your email, type y. Otherwise, you type n.

Next, you must do a short puzzle or Captcha as a verification step. Then, click Create Account.

Then, you will be asked to enter a verification code sent to your email. So, could you check your inbox or spam on your email? If the GitHub email hasn’t arrived, you can click Resend the code to resend the code.

After entering the code, you can go through the process of personalizing your account. If you don’t want to do that, click Skip, and you’ll be taken to the GitHub dashboard.

2. Starting a New Project

To start a new project on GitHub, you must first create a repository. You can create a hold by clicking the button next to your profile, then clicking New Repository.

Then, you will need to enter detailed information about the repository. The following is an explanation of each column:

  • Repository name: the name of your repository. We recommend that you use a name that is simple and easy to remember. For example, ProjectPerdana2021.
  • Description: a description or description of your repository. You can fill it with your goal of creating this repository.
  • Repository type: There are two options, namely Public and Private. Public means that other people can see your repository. While Private, only you can access it. You just set it according to the needs of the project.

When you have filled in all the fields, click Create Repository.

3. Create a Code File

After creating the repository, you can create code files according to your project needs. To create a new file, click on creating a new file as shown below:

After that, enter the name and file extension according to the programming language used. For example, index.php if using the PHP language.

Then, you can directly code in the column below. When you have finished coding, click Commit New File to save the file on GitHub.

The following is an example of how the index.php file has been successfully stored in your repository:

4. Editing the Code File

Once your file is saved, you can also change its code. The trick, you click the file to be edited and click the pencil icon like this:

For example, we will revise the “Hello World!” text to “Hello Guys!”

After that, remember to enter a description of the changes you made in the description column below. Then, select the option Create a new branch for this commit and start a pull request to create a new chapter of this code. Please give it a simple name, for example, Index.php-revision-1. Then, click on Propose changes.

In the next step, click Create a pull request to continue the change process.

Afterward, GitHub will tell you whether the changes match the main code. If there are no problems, you can directly click Merge pull request to merge the changes into the main code.

If the merge is successful, you will see a notification like this:

5. Collaboration with Developers or Other Projects

The previous example is using your private/private repository. Then, what if you want to collaborate?

In addition to collaborating with your team, you can also collaborate with the developer of an open-source project.

The trick you need to find the project’s GitHub page. For example, we are trying to collaborate with WordPress. Then, click Fork at the top right of the project page to copy the repository to your GitHub account.

Ready to Use GitHub?

GitHub is a website that makes it easy for you to manage your code online. Both personally and when collaborating with other developers.

GitHub’s feature makes it easy to quickly develop your project while keeping an eye on the code changes you’ve made to avoid problems.

How to use GitHub is relatively easy, as described above:

  • Creating a GitHub account
  • Starting a new project in a repository
  • Create and edit project files
  • Collaborate on various open-source projects

With GitHub, you can also create a portfolio as a developer with public projects. However, of course, it still needs the support of a portfolio website, yes.

A portfolio website gives you the freedom of customization, such as design and features, and is unique thanks to using your domain name.