Github How To Use

If you don’t know how to use GitHub, then this article is for you. Github is a web-based platform utilized for version control. Git simplifies the method of working with different people and makes it easy to collaborate on projects. Team members can operate on files and easily merge their changes with the master branch of the project.

What is Github? 

To be really crisp about GitHub, it is a file or code-sharing service to collaborate with different people.

GitHub is a highly utilized software that is typically used for version control. It is essential when more than just one person is working on a project. For instance, a software development team needs to build a website, and everyone has to update their codes simultaneously while working on the project. In this case, Github supports them to create a centralized repository where everyone can upload, edit, and manage the code files.

Why is Github so popular? 

GitHub has various advantages, but many people often doubt why not use dropbox or any cloud-based system? Let me take the same case forward to answer this question. Say more than two software developers are working on the same file, and they need to update it simultaneously. Sadly, the person who saves the file first will get precedence over the others. While in Github, this is not the case. Github document the changes and reflect them appropriately to avoid any chaos between any of the files uploaded.

Therefore utilizing GitHub’s centralized repository avoids confusion, and working on the same code becomes very easy.

Now let me list down how GitHub makes it simple:

    • GitHub presents you with a beautiful visual interface that helps you to track or manage your version-controlled projects locally.
    • Once you register on GitHub, you can connect with social networks and build a strong profile.
How To Use Github Desktop
How To Use Github Desktop

How to create a GitHub Repository?

A repository is a system storage space where your project lives. It can be local to a folder on your system, or it can be a storage space on GitHub or another online host. You can keep code files, text files, images, or any file in a repository. It would be best to have a GitHub repository when you have done some changes and are able to be uploaded. This GitHub repository acts as your remote repository. So let me make your task easy; follow these simple steps to create a GitHub repository:

  •  Go to the link: https://github.com/. Fill the signup form and hit on Sign up for Github.
  •  Click on “Start a new project.”
  • Enter any repository name and click on “Create Repository.” You can also describe your repository (optional).

If you noticed by default, a GitHub repository is public, which implies that anyone can view the contents of this repository, whereas, in a private repository, you can choose who can view the content. Also, the private repository is a paid version. Also, initialize the repository with a README file. This file includes the description of the file, and once you check this box, this will be the first file inside your repository.

Git and GitHub

  • Self-Paced Learning
  • Real-life Case Studies
  • Assignments
  • Lifetime Access

So now my central repository has been successfully built! Once this is done, you are able to commit, pull, push and perform all the other operations. So now, let’s move forward and understand branching in GitHub.

Step 3: Create Branches and Perform Operations

Branching: Branches support you to work on different versions of a repository at one time. Let’s say you require to add a new feature (which is in the development phase), and you are afraid at the same time whether to make changes to your main project or not. This is where git branching arrives at the rescue. Branches enable you to move back and forth between the different states/versions of a project. In the above scenario, you can create a new branch and test the new feature without hitting the main branch. Once you are done with it, you can merge the changes from the new branch to the principal branch. Here the principal branch is the master branch, which is there in your repository by default. Refer to the below image for better understanding:

As depicted in the above image, a master/ production branch has a new branch for testing. Under this branch, two sets of changes are done, and once it is completed, it is merged back to the master branch. So this is how branching works!

Let’s move ahead in using GitHub’s blog and learn how you can create a branch.

To make a branch in GitHub, follow the below steps:

  • Click on the dropdown “Branch: master.”
  • As soon as you click on the branch, you can find an existing branch or create a new one. In my case, I am making a new branch with the name “readme- changes.”

Once you have built a new branch, you have two branches in your repository now, i.e., read-me (master branch) and readme- changes. The latest branch is just a copy of the master branch. So let’s perform some changes to our new branch and make it look different from the master branch.

How to use GitHub: Operations

Commit Command:

This operation supports you to save the changes in your file. When you commit a file, you should always provide the message to keep in mind the differences. Though this message is not compulsory, it is always recommended to differentiate the various versions or commits you have done so far to your repository. These commit messages keep the history of changes which in turn help other contributors to understand the file better. Now let’s make our first commit; follow the below steps:

  • Hit on the “readme- changes” file which we have just created.
  • Click on the “edit” or a pencil icon in the rightmost corner of the file.
  • Once you click on that, an editor will open where you can type in the changes or anything.
  • Write a commit message which identifies your changes.
  • Click commit changes in the end.

We have successfully made our first commit. Now this “readme- changes” file is different from the master branch. Next, let us see how we can open a pull request.

hitech work
Follow me

Leave a Reply

Your email address will not be published. Required fields are marked *