Technology and Marketing Insights

What is Git? A Beginner’s Guide to GitHub

If you are someone who doesn’t know anything about Git and GitHub, then you have come to the right place. Here, we have brought a full guide for beginners and you will understand it very easily. Using the Git platform makes the process of working with other people easily. The team members can work on files and can easily merge the changes in them.

Let, us check out what is Git and GitHub in detail?

What is Git?

Git is free, open-source software, that was created by Linus Torvalds in 2005. It is a version control system that was developed to work with different developers o the Linux kernel. It can be downloaded on your computer easily. If you want to collaborate with other developers on a coding project then it is good to use Git. Or you can also work on your own project via Git.

Download Git

You can check if you already have installed Git on your computer by typing the command git --version in the terminal.

If Git is already installed then you will see which version it is. And if you don’t have Git installed then visit the official website and download it by following the instructions to install it.

You can store any content using Git, and mostly it is used to store code and it provides many amazing and useful features. In real-life projects, there are multiple developers working. So, the developers need a version control system to make check that there are no code issues between them. Even the project requirements changes often, so this version control system allows the developers to return to an older version of the code.

What is GitHub?

Github is the social code-hosting site that is used by so many people. It allows you to host your Git projects on a remote server. Do not get confused between GitHub and Git. As GitHub is a hosting server and there are many other companies offering hosting services like GitHub, including Bitbucket and GitLab.

Git vs GitHub

How to use Git & GitHub?

GitHub account creation

  • Visit GitHub’s website to create your account by filling the registration form.
  • Install Git’s tools on your PC. Here, we are using CLI to communicate with GitHub.

For Ubuntu:

  • First, you must update your packages.
sudo apt update
  • Now, install Git and GitHub with apt-get
sudo apt-get install git
  • Verify that Git is installed correctly.
git --version
  • Now, run the following commands with your information and set a default username and email while you save your work.
git config --global user.name "MV Thanoshan"
git config --global user.email "example@mail.com"

Getting Started with Git and GitHub

There are so many different ways to use Git and GitHub. Getting started with GitHub is so easy, you don’t need to be any master code. You must find your terminal and get comfortable with it. Using terminal commands can make things much faster.

Terminal vs GUI

There are two ways of using Git, one is by typing commands in the terminal and the other one is by using a graphical user interface (GUI) like Sourcetree or GitKraken.

So, if you select using Terminal, then you need to know which Git commands are needed. However, you don’t need to remember them by heart. You must remember only a few of the important commands that you will use regularly. The rest of them can be checked while you need them.

If you choose to use GUI then there are different actions you need to take. No matter what you choose to use, you need to first understand the basics of Git, then only you will be able to use it properly.

Here is an example of using Git in Terminal, even for GUI, mostly the steps are similar.

How to Prepare Project Folder in Git?

You can create a new project or can use the existing project to use Git.

If you choose an existing project then, just search for it into the project folder in the terminal.

And if it is a new project then, you need to create a new project folder and then navigate to the project folder in the terminal.

What is a Git Repository?

In our project folder, the repository is the .git. This will track all the changes that are made to the files in the project and record the history.  In this example, the repository is referred to the local repository.

When we upload the local repository to hosting services like GitHub, GitLab, and Bitbucket, then this repository in the cloud is known as a remote repository.

To collaborate with other people and to take backup of the projects, it is important to use a remote repository.

How to Create a Git Repository?

When you open your project folder, to start using Git, you need to create a repository using the git init command.

Once the command is executed in the terminal, press enter. You will not see much difference, but Git can sometimes hide many things. So, to check what Gid is hiding behind, you must view the hidden files. Here’s how you can view hidden files:

  • Open your project folder in the file system.
  • If you are using Mac, then select Command + Shift + Dot to see the hidden files on your file system.
  • If you have Windows OS, then change your view settings and view hidden files.

In Terminal, you can view hidden files by using the command ls -a.

Now, in the project folder, you need to see  .git folder.

How to Collaborate with Other Developers Using Git?

If you want to collaborate with other developers then they can download the remote repository from the hosting service that you have uploaded to their PC. This will allow them to have the project on their PC. Now, the project is on their computer so, it is also called a local repository.

Remote repository

If there is one project with multiple developers, each one will have a local repository on their PC. And the remote repository is the one that is contributed within them to share their work.

So, this is all about Git and GitHub. We hope this article was helpful to you.

Leave A Reply

Your email address will not be published.