roxxhub

What the hell is Git ? How is it different from GitHub ?

Git is a free open source distributed version control system. A version control system is nothing but a piece of software which tracks and manages changes in files or codes.

Github is an internet hosting service which lets people work on projects using Git.

” – ๐Ÿค“

Didn’t get it. Well that is what this post is for.

What is a version control system?

Lets take a simple example. Lets say you and your friends are working on a project. Since each one of you have your own personal computer, The project folder must be shared / available to others.

Here’s the naive way to do it – Each one of you, whenever does some changes in the folder, sends a copy of it to the others. Through email, or flash drive etc. Of course that’s gonna be a problem. Specially when the size of the folder becomes too large, or if there are many people. In fact whatever I just stated is used no where.

A better way (how it actually happens) to do this is by using a 24/7 open server. This is where each one of you log in and do whatever changes you do. This is a so called ‘collaborative project’.

Recording versions

Now imagine you and your bois are having a server , or often called as a ‘repository‘, where you are working on your project.

A very useful thing you can do is to have different versions of your project. New version get created every time there is a change and each of them is stored there. This could help a lot. Imagine something goes wrong while making some change. You would always have backup.

And this is where a version control system comes into play. A version control system does that for you. And Git is one of the most used one.

Types of version control system.

There are 2 kinds of version control system.

  • Centralized.
  • Distributed (decentralized)

The difference is simple. In centralized version control system, the version record is stored in the repository itself. Where as in distributed, a copy of the repository is held with every one.

To understand more about distributed technologies , Read this.

Downloading Git

git download -- git-scm.com
  • Download the latest version according to your operating system
  • This should give you a .exe file.
  • Run it and follow the default installation settings
git installation.
  • Save it wherever you want.

Creating a GitHub account

As we have discussed, Git is software which helps in tracking changes history of a folder. We also need a repository where the actual project data is stored. And this is what Github is for. GitHub provides you a cloud based server, where you can store all your project files.

It is free to use, but it also has some paid services. But the free one is sufficient for now.

Just go to github.com and sign up. Shouldn’t be a big task. When you are done, you might be redirected to a homepage like this

You can go ahead and make a new repository. Either public or private

Public repositories are visible for every one. And Private are not.

For this tutorial, I have created a repository named git-tutorial in my github account.

Git setup

There are 3 ways you can use Git

  • By using the terminal (bash).
  • By using an editor / IDE’s
  • By using a GUI client.

We are going to use the bash as it is the most recommended and powerful way to use Git.

Many editors like VScode already have built in support and plugins for git. There are also software which provide you a GUI, like sourcetree and gitkraken. While these two options are great if you want to use. But bash is still my go to move. And tha’ts what we’ll be using in this tutorial.

Git bash is basically a terminal where you can run Linux commands. It is the most important thing in the installation.

If you have completed the installation, you should have this on your computer. The first thing we need to do before any thing is set three things – the username, the user’s email address and the default editor you want to use.

To do so type these things in the bash one by one

  1. git config –global user.name “your user name“.
  2. git config –global user.email “your email“.
  3. git config –global core.editor “your editor cmd command“.

By default the editor is selected as vim (this is downloaded with git and you can use it for git only). If you want to use notepad, simply write “notepad”. To use vscode you can can write “code” in the parameter. (You can change them whenever you want).

git bash

Conclusion

This was a short introduction to git and github. I hope you liked and understood the concepts presented here.

In the next post, I’ll be showing you how you can put your projects into github from your computer.

3 thoughts on “What the hell is Git ? How is it different from GitHub ?”

  1. Hey there! I simply want to give you a big thumbs up for the excellent information you have here on this post. I am coming back to your website for more soon.

  2. The next time I read a blog, I hope that it does not disappoint me as much as this particular one. After all, Yes, it was my choice to read, nonetheless I truly thought you would probably have something helpful to talk about. All I hear is a bunch of whining about something that you could fix if you werent too busy looking for attention.

Comments are closed.