What are Git and GitHub and How to learn them

Maisha Maliha
4 min readMar 16, 2023

--

When I started university, which was like 2019, I immediately opened my GitHub account without really knowing much about it. I don’t think it can be explained that well to someone who doesn’t even know why they need it in the first place. But hopefully, by the end of this post, you will know if you need it anywhere in your computer life or not.

WHAT IS GIT?

By now you know that Git and GitHub are not the same things. Git is a free open-source “distributed version control system”. so what does this mean? Let me explain with an example. Think about your android application or in fact android OS itself. It has different versions. What is a version? Look at the code below.

let add;
let a = 50, b = 25;
add = a+b;

Here you can see that this is a simple addition. Let's say this is my new software. It is version 1.0. After a while, I thought about adding a new feature. I want to be able to multiply too. So I added some more code and then published it again.

// this code existed in version 1.0
let add;
let a = 50, b = 25;
add = a + b;

// this code has been added to version 1.2
let subtract;
subtract = a - b;

Since it is on top of my already existing code, it’s a new version and I published it as version 1.2. You could also make some major changes to your code and then release a new version like the 2.0 version.

// this code existed in version 1.2
let add;
let a = 50, b = 25;
add = a + b;
let subtract;
subtract = a - b;

// here is the major change for 2.0
subtract = ( add * 15 ) - subtract;
add = subtract * 25;

console.log(add + subtract);

WHY DOES GIT EXIST?

So, the version part is clear hopefully. What if I want to invite my friends over to work on my super new revolutionary calculator project? How do we combine our work/code seamlessly without copying each other's code and taking it with a pen drive on our computer every time we make a change? Also for every small to big change I make on my computer I have to inform my friends and also make them change it and work with it. You can see this becoming a bigger issue as we add more code or coders to the project. Hence, to solve this issue version control system like Git was created.

Git will let you go back and forth with your work, distribute your code to others, and also pull others' code to make sure your code base is updated with others.

WHAT IS GITHUB?

Git is for version control then what is Github? Git helps you work with your friends, where you and your friend's computer is connected locally without the internet. But what if you want to make your code open source as in open for all around the world to see and edit? For this we use Github. Github lets you share your code online with others around the world. Now your British/German/Finnish/Alien friend can edit the code that you are working on in Bangladesh through Github.

There are many cloud-based hosting online other than Github like BitBucket or GitLab. You can check them as well. GitHub is not the only way, so you know.

SETUP GIT

Firstly you need to learn Git and setup Git on your computer so you can version control your code base or a folder. And then you can use GitHub to upload that folder or your code base online for distribution.

I will refer to the main website of Git for everything so that you learn to use the main website for whatever you need. This will form a good habit of self-learning.

First download Git on your computer. You have to download Git according to your Operating System.

https://git-scm.com/downloads

Here is the link for windows

https://git-scm.com/download/win

Here is a link for Linux

https://git-scm.com/download/linux

After you are done downloading you can use simple Git commands for your version control of a certain folder or code base.

Start learning Git from their documentation

https://git-scm.com/book/en/v2

For any reference here is the link

SETUP GITHUB

It's time to setup GitHub for you. If you only have Git, then you can do everything with it except you cannot collaborate with anyone online. To be able to work with your friends or share your code with everyone around the world and make it accessible to the public or particular people or only yourself, you have to use Github.

Remember, you can use Github for uploading your code and it can be public or private or can be viewed or edited by particular people as you wish.

To be able to use Github you have to create an account on Github. And then if you want, you can use Github Desktop, a UI for GitHub—but it's not a necessity.

Here is the link to create your Github account

https://github.com/signup

Here is the link to GitHub commands and doc to get you started

https://docs.github.com/en/get-started/using-git/about-git

Here is the link to the Github desktop link

https://desktop.github.com/

Here is the guide link to the Github desktop

Hopefully, this post has helped you somewhat. Follow me for more tech-related posts.

--

--

Maisha Maliha

Hello, I am Maisha. I am from Bangladesh. I am studying CSE. I like learning new spoken languages and coding.