GIT-A Version Control System

Original article was published on Artificial Intelligence on Medium

GIT-A Version Control System

Staging made easy!

Well if you’re a developer and have ever worked in teams to deploy a full fledged products then you must have came across these fancy terms of Git and GitHub and must be wondering Why is it a necessary framework for every developer to work around it? If that’s the situation with you,then you’re at a perfect place to start you GIT journey! In this article you’ll come across what is GIT’s version control system and how it’s used to create pull or push request over GitHub.


Git is often referred to as a version control system to manage,monitor and keep tracks of updates in the computer files and coordinating work on those files among multiple people. It allows a wide section of developer community to work on the same source code rather than jumping every time from copying the necessary files from ‘Flashdrives’. Aparts,it allows developers to keep track on what others are working upon and gets informed regarding the regular new updates for a particular code base.

Lets imagine you’re assigned with a task of completing a project within a deadline. You’ve a team size of 3 dedicated developer. You started working at the earliest on it.You collected some of the necessary resources and you came up with designing the front-end of the required application. At the same time you want your other team members to have a track record of the progress of the current project and collaborate along with you to design the back-end and to fix the bugs for the same application. You have a restrain that all are situated remotely and due to Covid-19 and Social Distancing situations, it’s almost impossible to meet them physically. What ideas you’ll come up with to complete the project?

Probably,you’ll think of I’ll design the front-end and then share the zipped file of that to the back-end guy followed by the guy to fix the bugs on it and get the work done. Right? It’s actually not a bad idea but that will consume a lot of time and memory,bandwidth of data as well for sharing the same source of file to every other developer in the team. Meanwhile, If you came up with an update you need to share every update to every individual and it’ll get complex to keep track record of all the updates. For instance,you released fifth version of the update and came to know that bugs here can only be sorted by accessing the second released update of it and it will get complicated as here every developer need to search for only the second version of it. Concluding,here the major issue lies in working and collaborating at a stable version of the project. That’s exactly where Git comes in to address these issues.

First Things First

For Installation of the required version you can head on to this link and can look for the specified versions among all the available versions and can download it.

Getting Started With Git

There exist a wide a variety of git commands that a developer must be aware of. If we start discussing each and every command here, it won’t make much sense and is out of the context what we are aiming here. So,I’ll be leading you with some of the well-known commands that every developer must be aware of.

  1. For Version Checking
$ git --version

O/P: git version

It gives the current version of GIT installed

2. For setting up Name and E-mail

$ git config --global "Aryan"
$ git config --global ""

Check Output using :

$ git config --list


filter.lfs.clean=git-lfs clean — %f
filter.lfs.smudge=git-lfs smudge — %f
filter.lfs.process=git-lfs filter-process
http.sslcainfo=C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
filter.lfs.clean=git-lfs clean — %f
filter.lfs.smudge=git-lfs smudge — %f
filter.lfs.process=git-lfs filter-process

Here, you’ll see it has a field stating the Name and Email-ID of the user entered.

Stages involved in Git

Git is accompanied with three stages overall ranging from initializing, adding it to the staging area and finally committing it to the required branch. After committing it can further be pushed as a request over to open-source code base like GitHub.

1. Initializing

$ git init

This command is used inside a repository for initializing the Current Working Directory that can be tracked by Git. A repository is nothing but an active working directory in which a developer is designing a product or a code base file. This is the first Stage of Initializing a Directory. This git init command creates a new Git repository. It can be used to convert an existing, unversioned project to a Git repository or initialize a new, empty repository. Most other Git commands are not available outside of an initialized repository, so this is usually the first command you’ll run in a new project.

2. Staging

Then comes the Staging area where a developer is most interested in keeping all of his modified file. The git add is a command, which adds changes in the working directory to the staging area. With the help of this command, you tell Git that you want to add updates to a certain file in the next commit. But in order to record changes, you need to run git commit too.

$ git add .

The above syntax is used to add all the files to the staging area.

$ git add abc.txt

The above command is used to place only the selected file i.e abc.txt to the staging area.

It can also be understood as an analogical example. If in a race of marathon , a voice can often be heard of stating On you marks, Get Set, Go indicating if Go is heard,race will get triggered. It is that Get Set condition that takes place prior to the Commit Section where every changes must be present in the Staging Area.

Firing Add command Specifying the file Name

3. Commit

This is the final stage where all the changes takes place and are finalized for the remote repository. Each Commit represents the changes made to the project in the past with the time specified and Author of the Code. With reference to our previous example, it is that Go condition when Heard race triggers. In the similar fashion, when Commit is fired all changes are saved and it returns:

O/P after firing Commit

Note: Option -m is used to store the final message.

If you can see there’s a (test) written over there. It is actually a seperate branch on which I’m working. It’s a good habit if you’re not committing your entire work updates on the master branch. Keep the master branch as an authenticate Source for Safety and rather create another branch and work on it.

Creating Branch

Well creating a new branch while working on repositories is as important as structuring the workflow. It can be implemented with the help of a very basic command which can be seen below:

$ git branch test

It shows that a new branch named as test is created and it is then followed by adding the files into the staging area followed by the final commit.

Switching to Branch

Well creating a branch is an easy task then it is followed by accessing the above created branch. It is possible by checking out to that specified branch. Inside this branch,the changes made by you won’t effect the resource files in the main branch. It is obviously a recommended and crucial stage while creating a branch. It needs to be done usually before committing and adding the files and changes to the staging area. It is done as follows.

$ git checkout test

Connecting with remote URL

Now, let’s assume a condition in which you want to connect your remote system resource files with Global Unified Resource system over Internet domain. Well that’s actually possible with GIT functionalities. It gives you add-on functionality in which you can connect and push your local codebase files to GitHub or other resources in just a single shot.

So, for this to happen make sure to connect with the URL. The following command helps you to do so.

$ git remote add mine

Here remote keyword is used to identify and establish a server system with the name keyword as mine. You can use your own keyword instead of mine but the keyword remote is fixed . Mine is followed by the URL you want to connect your Remote Repository with.

Working Life-Cycle of Remote Repository via GIT

Checking the created Server

Just to ensure whether your remote server has been created or not. You can check it with a Command known as:

$ git remote

When you’ll fire this command. You’ll come to know it’ll have a branch mine which is a proof of an established connection.

Pushing the files

Well this is the final stage where all the crucial work of the developer life-cycle comes to final stage where he/she pushes his/her local remote CodeBase files to the above connected URL source namely GitHub for instance. It is possible with the help of the command:

$ git push mine test

Here in the above command you’re pushing all your final commit changes from the local remote repository to the above specified server established under the keyword “mine”. So, here “test” is the branch in which you’ve checked out and have committed all your changes from the staging area to commit area. After this you’ll be able to see the pull request onto your repository. If you’ve the rights to that specified repository you can compare and create the pull request and will be able to merge it as well.

GitHub Architecture with GIT

This was briefly all about GIT. If you dive deep into it there’s whole lot variety of commands that are used in GIT. Explaining all of them in this article will go beyond the scope of what we are aiming. For a clear understanding you can go on to it’s official Website and check the documentation for higher purpose. I believe I was able to make you curious enough regarding GIT. For further suggestions or queries you can reach out to me on my LinkedIn profile.

Happy Coding! Smart Learning!