02. How Version Control Systems Work

In order to fully appreciate Git's features, we should go over the three main types of Version Control Systems.

1) Local Data Models

In the earliest form of version control, developers had to use the same filesystem. Here, a multi-user system, such as UNIX, would have to be necessary to handle multiple users along the filesystem tree.

In one of these models, Revision Control System (RCS), the most current copy of files is stored with patch sets created per change. By summing up these patches and applying them to the files, users were able to recreate the project at any point in time.

2) Centralized Version Control Systems

Although a Local Data Model could work, it was difficult to manage once collaborators across the world joined in on projects. Thus, Centralized Version Control Systems (CVCS, also known as Client-Server Models), were developed. Here, the entire repository lived on a server, and developers checked out the files they wanted to edit. Once they were done with their edits, they would commit them back to the main server.

Centralized version control system.
A Centralized Version Control System. Users could check out files they wanted to work on, then commit them once they made their changes.

By keeping all files in one location, the lead developers controlled exactly who edited which files. However, CVCS's come with a downfall. A server crash or power outage would result in no one being able to work on the project. Scarier is that the entire code base could be wiped out without proper backing up.

Drawbacks of an SVN Version Control System.
A major drawback CVCS is that the server must be up and running in order to work on the code.

3) Distributed Version Control Systems

In order to improve upon all the drawbacks of the previous systems, developers came up with Distributed Version Control Systems (DVCS), where a copy of the entire code base could be stored locally on every contributor's system. This makes files and version control operations increasingly easy to work, as no Internet connection is required to edit any files. Furthermore, if the main repository goes down or is deleted, it can easily be backed up by any local repository.

Distributed Version Control System.
A Distributed Version Control System. Each collaborator has a local copy of the repository, so no Internet connection is required.

When a user wants to make a change to the repository, he or she first commits all changes to his local repository. The developer can then push these changes to the main repository; to keep other developers in sync, they pull them the changes in.

You'll see that Git falls into the category of DVCS. Now let's install Git and get started!

Ace your Technical Interview

Programming Interviews: Exposed

Ace your Technical Interview Try Algorithms

In today's tight job market, competition for programming jobs is hotter than ever. This third edition of a popular guide to programming interviews includes new code examples, information on the latest languages, new chapters on sorting and design patterns, tips on using LinkedIn, and a downloadable app to help prepare applicants for the interview.

$ Check price
29.9929.99Amazon 4.5 logo(94+ reviews)

More Algorithms resources

Learn how teams work in Agile

Scrum: A Brief and Agile Introduction

Learn how teams work in Agile Try Productivity Tools

If you're looking to learn the elements of Agile development and Scrum, this is the book for you. This book has been reviewed by many, and sought after as a must-read for anyone who works in agile. The book is brief, with no anecdotes nor reiterations. Just pure content to help you graph what Scrum is in no time.

$ Check price
9.959.95Amazon 4.5 logo(568+ reviews)

More Productivity Tools resources

Ad