Git basics

Introduction

Hello there! I'm Dr. Chimp, your Git tutor. Today, we will learn the basics of a distributed version control system called Git.

What do you do when you want to recover past versions of a file?

The most common way to do it is to save multiple files with different dates and file names (eg. 12-02-2014-monkey_code.php). However, this method is often cumbersome especially when we are dealing with hundreds of files, making it close to impossible to manage.

Examples of backing up a file

Naming files randomly like the above example also makes it difficult to distinguish the later versions from earlier ones, or who they are were edited by. Most importantly, it is impossible to find out what changes have been made simply from file names.

When team members are editing a file simultaneously, things may get messy and overwriting may occur.

Failure examples while working as a team

This is when a version control system like Git comes in handy.

Version control with Git

Git is a distributed version control system originally developed to manage Linux source codes.

Using Git, you can easily view the revision history of your source code to track changes and easily go back in time to learn about the differences between different versions of your files.

If the latest version of a file is on the shared repository, Git will prevent an unintentional overwrite by those maintaining an older version of the file.

Examples of team works using the management of versions

With Git, it is unnecessary to manually backup a copy every file version (ie. saving multiple copies of your source directories).