GIT OVERVIEW

GIT is an open source Version Control System (VCS) that emphasizes on speed and efficiency. It is a very popular Version Control System used by many software development projects around the world.

What is Version Control System?

A version control system is a software used to keep track of changes made to one or more files over time.


Data as Snapshots

GIT store data as snapshots. A snapshot is a state of the files stored in the GIT repository at any point of time. Each change (commit) to the repository will create a new snapshot.

git-snapshot

GIT is fast

Operations in GIT are very fast as compared to other VCS, since the operations are done in the local repository.

GIT is a distributed version control system, where the users need not always work on the remote repository. The users can copy a remote repository to the local machine. This is called cloning. Each cloned repository is a full copy of the remote repository and contains all information that the remote repository contains.

We generally create a clone of the remote GIT repository in our local system. All operations are done to this local repository. This is one of the major advantage of GIT over other VCS. This feature enables developers to work even when they are not connected to a network. All changes done to the local repository can later be pushed to the remote repository when network is available.

git-snapshot

File States in a GIT project

Any file in GIT can be in three possible states: committed, modified or staged.

  • Committed means the file is stored in the repository. These files reside in the GIT directory.
  • Modified means the file is modified and the latest version is not stored in the repository. These files reside in the working directory.
  • Staged means that the file was modified and is marked to be included in the next commit snapshot. These files reside in the staging area.

Git Config

GIT Config is an important tool that can be used to set important configuration variables. These configuration variables are stored in a config file that resides in 3 possible places.

  1. <git installation directory>/etc/gitconfig. This file stores system wide variables which are applicable to all users in the system.
  2. C:/Users/<username>/.gitconfig. This file stores configuration variables specific to the user. This file overrides variable values in config file at point 1.
  3. In the repository (.git/config). It stores configuration variable specific to the repository. This file overrides variable values in config file at point 1 and 2.
git-snapshot

Using git config to set configuration variables

Open GIT command prompt (GIT Bash) and use the command below. GIT bash can be opened by right clicking on the desktop as shown in the figure.

Syntax:

git config [file_option] <variable_name> <variable_value>

where, file_option is optional, possible values are:

   --system: system wide config file.
   --global: user specific config file

Example:
git config --global user.name "Cube Article"
git config --global user.email [email protected]

To read a configuration value we can use the following command.

git config [file_option] --list

To learm more we can use the below command which list all option available for "git config"

git config --help

The --help option can be used to get help about any commad in git.

RELATED ARTICLES

Git Branching Support

Branching is a major part of any modern version control system. Git provides a unique branching feature which sets it apart from other version control systems. This article covers the various aspec...

View Article

Creating and using GIT Repository

A GIT repository is where GIT stores all the project files. We can either create a new repository or clone an existing one. This article shows how to create/clone a repository and few basic operatio..

View Article

Tagging in GIT

Tagging allows us to mark a specific point in the commit history or snapshot. A tag is typically used to mark a project release. This article shows how to create tags in Git.

View Article