Saturday, June 28, 2014

Git - Revision Control System

Every software developer has to use the version control or revision control systems to better control of the project. Revision Control system maintains the history of changes to each document of a repository. When you start a project with a revision system it is at revision 1 and with each change revision increment. So at any time, you can go back to any revision.

There are many Version Control Systems (VCS) available to use which includes Git, SVN, CodeVille, Visual SorceSafe and much more. Here I am going to discuss the Git an open source version control system. Git is the distributed revision control system with an emphasis on performance. Git is most widely used revision control system.

What is GIT?

GIT is an efficient open-source Revision Control System. It tracks the changes history of the content such as files and directories. Git helps people to work together as a team, all using the same directories and files. It allows resolving the confusion that may occur when more than one person changing the same files by maintaining the history of each change from each user.

Git maintain the versions at local machine along with a remote machine, all changes firstly log at local machine of a user and when user push these changes it also gets logs on the remote machine.

How to Install Git?

If you are installing it on windows you can download it from GIT-SCM. It will download GUI software for Git a handy tool for the users who found command line difficult to use but also give you command line console.

For installation of Git via native packet manager for example, on Debian (or Ubuntu):

sudo apt-get install git-core

Or on installation on Mac OS X, using MacPorts:

sudo port install git-core+bash_completion+doc

or using fink (an effort to port and package open-source Unix programs to Mac OS X):

fink install git

or using Homebrew:

brew install git

On Fedora (Red Hat based distributions):

yum install git

Creating New Repository

Once you are done with installation of Git, you are ready to create a repository of your project. For creating a new repository\project, you need to setup a remote machine. To setup project remote server you need to run the following commands:

ssh #to connect with remote server

mkdir my_project_repository #create a directory for the project
cd my_project_repository #open new created directory

git init #create a git repository


Now you are done with your server close your connection to the server and run the following commands on the local machine:

cd my_project_directory #open your project directory
git init #initialize git on the directory
git add * #add all files to the repository
git commit -m "My initial commit message" #commit with a message
git remote add origin #set remote machine address to the local repository
git push -u origin master #push files to remote

Clone of Repository

Now your machine has configured, all of your team members can get the clone of the repository.

git clone
cd my_project_repository

Now each team member can work on the same repository without worrying about changes being made to same files. Let the Git manage the history of each change to each file and anytime you can revert back to the revision.

Hope you found this article informative In next article we will see some more commands to handle repository like creating branches, adding new files, commit your changes and more. Please post your feedback in comments.

You may also like to see:

No comments:

Post a Comment

Life insurance policy, bank loans, software, microsoft, facebook,mortgage,policy,