22 Nov 2013

Source Control

Source control also known as version control and revision control have been a great technology for managing the changes in computer programs also allowing multiple developers to work on a project without interrupting each others work. It has been here for a while now and there are numerous distributed model tools are developed for this purpose, tools such as Git, Mercurial, SVK, Codeville, Bitkeeper e.t.c. Though some of this tools are proprietary softwares, Open Source community has provided open version of this tools, the most widely used being Git.

Some of this tools are integrated in a more user friendly environments such as IDE's and Web based application, such as the Git, which makes it easy to create and manage git repositories straight from Eclipse, github.com, bitbucket.org. Personally i make use of the both github and bitbucket to manage my projects.

The idea of version control systems is to keep a sequential record of a file from the first revision to the latest. Programmers usually use the concept of branching to keep parallel stable versions of code. Each developer assigned to work in a feature works on a separate branch of his own, after which sends a pull request and it is then merged into the master after being reviewed allowing multiple developers to work concurrently.

Git works in almost different way than other know VCS's, it specifically treats is data as a set of files and anytime one stores some data or makes changes, git takes a snapshot of the files and saves the reference to it. Also whenever a file is not changed git doesn't store the files again making it a bit more efficient. Git has various workflows; Centralised workflow, Gitflow workflow, Branch workflow and Forking workflow. This workflows are a design way to handle or manage your data, create a branch from master, work on it, merge back to master.

The basic branch workflow involves creating a repository, initialize git with git init, clone the repository with the command git clone [url], do your work in the branch created on your system, add all the files git add * or add the individually git add [file], commit your changes with a comment with git commit -m "comment", and push it to master with git push origin master. Master is the original project history and it is not advised to work on master but on the dedicated feature branch, this avoid the problem of the master containing broken codes.

This is just a summary of Source control with specifics on Git, a more detailed tutorial will be in place in future. A lot of companies use version control for projects and it is advised to learn how they work and work on some yourself as it will serve a great deal when working in teams.



Tags:
Stats:
0 comments