Intro to GitHub

What is Git?

Git is distributed revision control software, which allows a team of people to work together, sharing the same files. It tracks the version and as well as the history of every single file inside the project. That means in any point of time if you want to load a file from previous version, or want to see who have made what changes to which file and when; all those can be done easily by using Git. If you want to know more about git basics, you can go through the getting started with git basics article.

What is GitHub?

GitHub is a source code sharing and publishing service. The heart of GitHub is ‘Git’. GitHub is used as a central storage for the repositories. You can create a repository (project) in GitHub and share that with anyone (or with people you allow) and all of you can develop the project together. This is the gist of GitHub; but if you want to know more you can go through the Wikipedia page.

Why to use Git & GitHub?

  1. To work as a team.
  2. To get read of the tension of file merging.
  3. To keep track of every modification.
  4. To have a comfortable control on versions.
  5. To work anytime anywhere.

What do you need, to start with GitHub

A github account:

Go to and create an account. Or If you already have, login.

A git tool in your computer:

You need the software git in your machine. Here are the links:

Create and Clone Repository:

Step 1:

First of all we will create a repository (something like a shared directory) in GitHub. So after login in to github, at the right hand side you will find the link of create a new repository.

create repository image

Click on that link and create a new repository. As a free user you cannot create a private repository. So go with public one.

create repository image 2

Step 2:

After creating a repository, you will be redirected to the repository page. This is the page where you will find all the files of your project. In the sidebar you will get the link of the git; which is very much necessary to clone the repository to your local. Copy that link.

repository link image

Step 3:

Now come to local. Create a directory somewhere in your computer. We’re going to make this directory as your local repository.

After creating the directory, go inside of it and right click the mouse.

You will find two links in the panel; ‘Git Gui’ and ‘Git Bash’

local repo tools

Step 4:

$ git clone

Click on ‘Git bash’ and you will find a command prompt type window infront of you.

Type ‘$ git clone’ followed by your github repository link which you had copied and hit ‘enter’.

local repo 2

Step 5:

You will find that a folder is automatically created. This folder is actually the clone of the repository you created in github.

So this is how the repository is created. Now similarly other people can also clone the repository and get the files there.

Identify Yourself

$ git config –global “Your Name”

$ git config –global “”

Without identifying yourself Git wont allow you to commit or to do some other stuffs. (We will discuss about commits and all afterwords). Identifying is a one time process. You don’t have to identify yourself every time. Once you do that, Git will save your identity in your local server. You just have to run the commands mentioned above. Here is a pictorial representation of it.

git identify

Commit Command

In simple words, commit means make it ready to save in the central repository. If you add, delete or modify any file in your local repository, you have to commit them so that they can get saved to your central repository. Let’s explain with a step by step example.

Step 1:

Add a file (suppose the name is my-file.txt) to your local repository; that is, the folder in your computer. (** You have to go inside the folder and add files and all; the parent folder scope doesn’t belong to the repository)

local commit 1

Step 2:

$ git status

$ git add yourFileName

$ git commit –m “Added a new file named my-file”

Right click on anywhere in your directory and open ‘Git Bash’. Type ‘$ git status’ and hit enter. You will find the changed files (in our case my-file.txt) are listed with red color. Now let’s commit the file. To commit a file you first have to add the file to stage. To add the file type ‘$ git add my-file.txt’

local commit 2

Now the file is on stage and ready to commit. You can check the status using the ‘$ git status’ command.

To commit the file run the command ‘$ git commit –m “Added a new file named my-file”’

Now the file is committed to the local server. Next step is to push the changed files to github.

Push Command

$ git push

Push means saving the committed files to the server; in our case which is github. As our my-file.txt is already committed, so we can push the file.

To push, you just have to execute the command ‘$ git push’.

It will ask for your github username and password. Provide the right credentials and file will be pushed to the github repository you created.

Go to open the repository you created and you will find the my-file.txt there.

saved file in repository

Pull Command

$ git pull

Pull is used to copy the modified files from server to your local repository. The command is ‘$ git pull’.

As you have pushed the file ‘my-file.txt’, suppose your friend John is also working on the same repository and want to have your changes to his local. Then he will execute the pull command.

If you and John are working on a same file, then after pulling, the git may not merge the files every time. If it can’t merge it by itself, it will throw a conflict error and you have to resolve the conflict and commit again.


Git and github is fun. Don’t get scared, rather start working today. Once you and your team get your hands on it, you people will really enjoy it. Git immersion provides you a handy set of tutorials to learn, understand and use git. You can also use ‘Git Gui’ instead of ‘Git Bash’ for a graphical interface.

Github provides you various facilities including private repository, using which you can restrict and allow specific users to view and pull your repository. But this service is paid. Many organizations uses github to develop and manage their big projects. GitHub also helps developers to get engaged with various well knows open source projects. So overall, github is sort of facebook for developers.