Version Control with Git (Part 1)

In modern programming, it’s common for developers to work together. Sometimes, we just want to track the ‘history’ of work. Many have tried so many approaches to solving these problems. The common approach is generally the use of Version Control Systems.

A Version Control System allows developers to work together and see the history of work done. Generally there are 2 types of Version Control System

  1. Centralized Version Control Systems (CVCS)
  2. Distributed Version Control Systems (DVCS)

I will be discussing Git which mainly falls under the Distributed Version Control System. But to get a clearer picture, let’s discuss with a common scenario: You and a few programmers have been tasked with developing a website for a company. Among the team, you are mainly proficient with JavaScript whiles another collaborator is great with HTML and CSS. The third friend is great with databases but he’s very helpful in other fields too.

Centralized Version Control Systems

With this approach, there’s a central store of the project files. Everyone is supposed to be a collaborator to this central store. A great implementation of this type of version control system is Microsoft’s Team Foundation Version Control (TFVC).

There is one major flaw to this approach though. If the main store goes down, it means that there is no collaboration until it get back up. Even worse, when the disk gets corrupted then everything is lost. Another problem lies in the fact that network connection is needed when we want to publish every change made to the work.

It is worth noting that current implementations have found a way around this problem though but not all.

Distributed Version Control Systems

Just like CVCS, there is a central store but each collaborator also has a mirrored copy of that repository locally. One can focus on the local copy solely and commit all the changes or only a single change to the central store. This means that if the server goes down, any of the collaborators can copy their version onto the server to restore it. An implementation like Git doesn’t rely on the central store so any operation can be performed locally. A great benefit to this is that, you only need network connection when you want to publish changes to the central store.

I’m sure you are relating the description of the various version control approaches to the scenario earlier. If you did that, then you should have realized long ago why DVCS are the most used approach in software development.


Git is a free DVCS that is used for software development. It is aimed at speed and distributed linear workflows. Git was created by Linus Torvalds (Father of Linux operating system) in 2005.

Back to the scenario mentioned earlier. You’ll have to create a central Git store for the project. Every collaborator will push final changes there. This could be created at GitHub, BitBucket, etc.

After that, each collaborator will create a local git repository and connect it to the central git store. This can be achieved like so:

git init

git remote add origin {url_to_central_store}

git pull origin master

Line 1 initializes Git in the folder you are using. Make sure you are already in the project folder of interest before initializing Git. Line 2 adds the url to your central store to your local Git using the ‘remote’ command. It is clear that all git commands are preceded with ‘git’.

Using Git requires you use command prompt or a bash to work things around. To use local Git repository effectively, clear understanding  of the structure is needed.

In part 2,  I’ll explore the Git commands and how to enhance collaboration with it.

Enjoy coding!!



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s