Git Tutorial - Introduction - Mostlikers

13 January, 2016

Git Tutorial - Introduction

It is a software that keeps a track of files and directories that we make, especially the text changes and allows us to compare between the changes (versions) that we created.

GIT is referred as a version control system (VCS). The primary purpose of the VCS is to manage the source code (source code management (SCM)).

VCS's are called as source code management tools.

GIT Tutorial - Introduction

Examples of version controls (non-source code):
File naming (budget_v1.xls, Budget_v2.xls), undo control + z (Windows), command + z (MAC).

A few version control softwares before git were Source Code Control System (SCCS), Revision Control System (RCS), Concurrent Versions System (CVS), Apache Subversion (SVN), BitKeeper SCM.

Source Code Control System (SCCS): 
This version control was bundled free with UNIX operating system, Since UNIX was free, so SCCS became popular. It was closed source software, developed in SNOBOL at Bell Labs in 1972 and was included in AT&T commercial systems. SCCS store the original file and then keeps the track of all the changes made.

Ex: If there is a file named budget.xls without version control, we would keep the track of changes by renaming as budget_v1.xls, budget_v2.xls, budget_v3.xls. If SCCS is used, then the first version of the file budget_v1.xls is stored and if any changes are made in later stage, then only the changes will be stored not the whole file.

Revision Control System (RCS): 
It is an open source VCS developed in 1982. This VCS is a cross-platform where as SCCS was UNIX only. It was more intuitive, had a better syntax with fewer commands and with more features. It was faster, as it has a smarter storage format. RCS keeps the recent file in the whole form instead of the original file, if you wanted the previous versions then you apply the changed snapshot. This is faster because we will work on the current document not on the original file.

The problem with RCS and SCCS was that they allowed to work with an individual file one at a time.

Concurrent Versions System (CVS):
CVS allowed to work with multiple files  at a time more over it also allowed to store our code in the code repository which can be put on a remote server and more than one user can work on the same file at the same time, that is they can work concurrently. It is an open source VCS developed in 1986.

Apache Subversion (SVN):
It was released in 2000 as open source software. It was faster than CVS and allowed to save non-text files like images which CVS couldn't do. The biggest Innovation for SVN was that it was not just tracking the changes to files or group of files, but actually it was tracking the directory as a whole. It was taking the snapshot of the directory and not just the file. It seems a small change, but SVN would track the history of directories.

Ex: CVS would not track the change if a file was renamed but SVN would track this change. If a file was removed or added or renamed SVN would track the changes.

CVS would also update files one at a time as it went either apply or read back changes. SVN would instead do transactional commit and apply all of the changes that happen to the directory or none of them at all. The snapshot in SVN was bigger than just the individual files as it was the entire directory.

SVN stayed a very popular VCS until Git was released.

BitKeeper SCM:
It was closed source released in 2000. BitKeeper had one important feature which was Distributed Version Control. The "community version" of BitKeeper was free. This version had some usage restrictions  and was used for source code of the Linux kernel. It became controversial to use proprietary SCM for an open source project (Linux) as SCM was owned by a company. In April 2005 the "community version" was stopped being free.

BitKeeper was not as popular as CVS or SVN, but it was important in creating Git because of its connection to Linux.

It was released when the community version of BitKeeper was stopped being free. It was created by Linus Torvalds. He wrote the new VCS from Scratch.

Git is  a command line tool and a distributed version control, open source and a free software the community can view the source code and contribute to it.

It is compatible with Unix system (like Linux, Mac OS X, Solaris) and Windows and It is faster than most other source code management tools. Better safeguards against data corruption. Git became popular and its popularity increased exponentially because of its features.

Distributed Version Control:
SCSS, RCS, CVS and SVN four of this VCS uses a central code repository model. There is one central place where you store the master copy of your code.

In Distributed Version Control, different users maintain their own repositories, instead of working from a central repository and changes are stored as "change sets" or "patches". It keeps track of changes and  not versions of files or directories.

Distributed version control focuses on change sets as a discrete unit and then those change sets can be exchanged between repositories. Here there are just many working copies each with their own combination of change sets.

All repositories are considered equal in DVC.

Advantages of DVC:

  • There is no need to communicate with a central server, which makes things faster and no network access is required.
  • There is no single failure point. If something goes wrong with the central repository, then the work would stop of those only who is working on it.

It encourages participation in the forking of projects and this is important in the open source community where developers can submit changes, fix bugs and improve the code.

Who should use Git?

  • One who works with source code and wants to track edits of text documents.
  • One who wants to share changes with the collaborators.
  • One who is not afraid of command line tools.
  • Programmers and developers (html, CSS, JavaScript, PHP, Ruby on rails, Perl, python etc.).

  • It is not useful for non-text files like images, movies, music, etc. It makes the changes and create a repository, but the changes are not visible as in case of text, in case of text Git shows the changes made in lines with line no. 
  • It also does not work well with files that are interpreted by an application like word processing, spreadsheets, PDF's etc., Git does not understand them as these require an application to interpret them.

No comments:

Post a Comment