What is GitHub and Why Do I Need to Use It? – Starweaver
what-is-github

what-is-github

When it is time to work on a new computer development project, whether you plan to create an app or some software, you will need to go through many iterations. The final project takes some time to complete, and you will need to collaborate with others to get the work done.

One tool that is amazing to work with is a Git and GitHub. Both of these can take the work of modifying and changing your project and turn it into a simple task. Let’s take a look at some of the different steps you can follow to use Git and GitHub for your needs.

What is Git and GitHub?

Before we dive into some of the semantics and all the nuances that come with these two options, we first need to explore precisely what Git and GitHub are all about and how you can use them for your needs.

To start, we have Git. This is an open-source version control system. To make this easier to understand, it is a program that can record files over some time. Any changes you earn can then be brought back to you later.

When a developer creates something new, they will make constant changes to the code to make it better. This allows them to release new versions up to and after the first official release. Version control systems, like GitHub, will help to keep all of the revisions in line while storing all modifications in the central repository.

This is important because it helps developers collaborate better. They can download the latest version of the software, make changes, and then upload the newest version. Each developer can also check on these changes, download the changes, and contribute as they need.

Then we need to look at what GitHub is about. While there are many cloud-based versions of control systems you can use on the web, GitHub is still one of the most popular to use. Git will be the part that helps make the changes and organize everything. GitHub is the place where the developers can store their projects and network with others.

How to Use GitHub

Now that we know some of the basics, it is time to dive in and see how to use this option. The first step is to install Git and create your account. You can easily do this by following the instructions on the website. This will help you to get a feel for the command line and sign up for the right account. The other steps you need include:

Create Your Local Git Repository

When you want to use Git to create a new project, you need to create a new repository first. To get this done, we will use the terminal. You may need to review a little if you don’t have a lot of experience using this.

To begin, open the terminal and find the location on your computer where the project should go. The “cd” command will do this by helping you change directories. So if you would like to do this new repository in the root of the folder, you would use the command:

git init

Add a New File

We will then want to add a new file to the project. You can choose the text editor you are most familiar with to finish this. You can also run the “touch” command.

Once you have time to add or modify files in the folder here, Git will notice that these changes were made in the repo. Keep in mind that Git is not keeping track of the file unless you tell it to.

Because of this, you need to use the “git status” command after creating a new file. This helps you see which files Git recognizes already. Doing this will tell you that Git sees that you made a new file, but you need to add the command “git add,” or nothing will be saved.

Understanding How Commit Fits In

One thing that many people struggle with when using this is how commit works. Commit is the record in this storage of which files you changed since the last commit happened. You will make some changes to the repo, and then you will tell Git to commit those files. This helps you to go back to the state of a project, even one in the past.

To add a file to commit, you need to add it over to your staging environment. The code you need for this is

git add

Once you have added this into the staging environment, along with any other files you work on, you can use the git commit command to save it.

Creating a New Branch

Creating a commit was discussed in the previous section. Depending on how many files you want to add in, it can take some time. You may want to err on the side of caution and commit the data often, so nothing gets lost.

Once you have made your commit, it is time to move on to creating a new branch. For this, let us say that you would like to create a new project, but you worry about how these changes will affect the main project. This is why you would use git branches.

These branches will help you to move back and forth between the different “states” your project is in. You can try something out, and once it is ready, you can merge the changes over to the main page.

Let’s say that you are on the master branch, and you want to do a new branch to help develop the web page. To get this done, you can run the code:

git checkout -b

This command will help you create a new branch and will move it off the master branch a little. After you run the order, you can use the “git branch” to confirm this branch is created. If you go back to the main unit while working on this, you will not see the changes or modifications. Once the new unit is complete, you can merge it with the central part.

Git and GitHub are great options to use when you need to create software, an app, or another computer product. It allows you to make corrections, update versions, and collaborate with other developers to make the best product. While there may be other choices out there to go with, GitHub and Git are one of the easiest, most advanced, and best-featured options out there.

WATCH LIVE CLASSES FREE

Learn from Leading Experts | Learn by Doing

Individual Sign-up
Register a Team
(with discounts)

Save even more for teams!
Find out more...

 

Current Streaming Courses

"The secret to getting ahead is getting started..." ~ Mark Twain