Difference between Git and SVN

Version Control System

A version control system (VCS) helps you to make changes in source code of the project and upload those to some central repository to keep the history of changes safe and remain available for other people of the project in order to get the updated code or merge their changes or make further changes. In simple words these are the tools which keep the history of thee source code and helps to access the history if required. These tools have their own collaboration models using which developers will share their code across teams.There are multiple such tools in market like git, svn, RTC, cleaarcase etc.

This article is targeting to put down major differences between two most famous VCS tools git and SVN so it is assumed that the reader already has some familiarity with code versioning systems, the concepts of revisions.

GIT

Git was initially developed to meet the demands of a control version system to manage the source code of the Linux operating system kernel.The development of Linux by its very nature required a distributed versioning model, where commits are scattered in several parallel lines of development (branches) and must go through an approval process. Some of the goals of the new system were as follows:

  1. Speed
  2. Simple design
  3. Strong support for non-linear development (thousands of parallel branches)
  4. Fully distributed
  5. Able to handle large projects like the Linux kernel efficiently (speed and data size)

Subversion or SVN

Subversion is a free/open source version control system (VCS). It is a centralized control system version that consists of a client (SVN)and a central server, accessed via TCP/IP, usually via SSH or HTTP/ WebDAV protocols. Initially developed by CollabNet in late 2000, and member of the Apache project since 2010, SVN has been adopted in many Java community projects due to the integration with development tools and features to solve problems of its predecessor – CVS – by the transactional support and performance improvements on communication between the client and the server.

Now let’s go through main differences between both tools:

1. Workflow:

GIT:

  • A Git repository stores the full history of all of its branches and tags within the .git.
  • The latest stable release is contained within the master.
  • Active feature work is developed in separate branches.
  • When a feature is finished, the feature branch is merged into master and deleted.

SVN:

  • The trunk directory represents the latest stable release of a project.
  • Active feature work is developed within subdirectories under branches.
  • When a feature is finished, the feature directory is merged into trunk and removed.

2. Distribution:

Git is Distributed Revision Control System which means, every developers checking out code from central repository/server will have their own cloned repository installed on their machine.

SVN have centralized Revision Control System, or server.

3. Storing data:

Git stores content as metadata.
SVN stores content as files.

4. Revision:

GIT does not have a global revision number.
SVN’s revision number is a snapshot of source code at any given time.

5. Location and size:

Imagine you are a developer on the road, you develop on your laptop and you want to have source control so that you can go back 3 hours.

With Git, you do not have the SVN problem. Your local copy is a repository, and you can commit to it and get all benefits of source control. When you regain connectivity to the main repository, you can commit against it.

With Subversion, you have a Problem: The SVN Repository may be in a location you can’t reach (in your company, and you don’t have internet at the moment), you cannot commit. If you want to make a copy of your code, you have to literally copy/paste it.

6. Content integrity:

GIT contents are cryptographically hashed using SHA-1 hash algorithm.This will ensure the robustness of code contents by making it less prone to repository corruption due to disk failures, network issues etc

SVN doesnटt have a hashed contents.This will risk to lose code and contents due to disk failure, network issues.

7. Preserving history

SVN is configured to assume that the history of a project never changes. Git allows you to modify previous commits and changes using tools like git rebase.

So none is better than other. Only needs defines which one is better in particular situation and use-case. Select as per your need.

Leave a Reply

Your email address will not be published. Required fields are marked *