Git vs SVN (Subversion)

Need advice about which tool to choose?Ask the StackShare community!

Git

132.7K
108.2K
+ 1
6.6K
SVN (Subversion)

716
538
+ 1
41
Add tool

Git vs. SVN - Help me Decide


When a brilliant idea for new software is conceptualized, the development process is usually executed by a collaborative team with a single goal. The effort put in by team members play a role in the overall growth of the software in the long haul. However, the team's effort will be difficult to measure and merge without the right tools.

Because software development thrives on the collaborative effort of teams, certain systems are crucial to the success of software projects, one of such systems is Version Control.

This article focuses on comparing two widely adopted Version Control Systems:

  1. Git
  2. Subversion (SVN)

General Overview

Version Control Systems (VCS) also known as Source Code Management (SCM) tools are a category of software that helps developers keep track of the changes made to a file or a set of files over a period of time. With a version control system, one could easily navigate to and through earlier versions of files.

Version control improves the development workflow and seamlessly integrates changes into different aspects of a project while handling file conflicts where they exist. It also makes it possible to easily backdate (navigate to a previous version) a project when an error occurs in the current version.

One of the most exciting features about these systems is how they stand as a traffic warden of some sort; organizing and documenting changes made by a vast number of developers without causing any form of blockage to the system.

Version control can generally be categorised under three (3) basic types:

  1. Local
  2. Centralized
  3. Distributed Version Control

Initially released on the 20th of October 2000, SVN is a centralized version control system, thus files are usually hosted on a central server which keeps track of various versions and organizes the client connections to the server.

Git, on the other hand, is an open source distributed version control system with its first release on the 7th of April 2005. With Git, clients are able to fully mirror the existing remote server (repository), including its version history locally. This means that on the loss of a server, the copies existing on any of the clients could be uploaded (in Git’s terminology “pushed”) back to the server to restore it. Every client holds a complete clone which is kept in sync with the repository (remote server).

Structure

Under this section, we will examine the differences between SVN and Git in terms of their operational structure. We will also look into the overall experience of development teams working with these systems respectively.

centralized-vs-distributed.png

This diagram from git-tower illustrates how developers carry out various version control operations when working with Git and SVN.

The structure of SVN demands constant network access in order to make commits. This means that development cannot continue without access to the central repository. Through its “checkout” functionality, developers are able to update their local “working copy” with a snapshot of a version of the project.

With Git, a “checkout” clones the repository from the remote server. This clone is a complete repository with commits, history inspection, version navigation and many other capabilities set up locally. The developer is able to work for as long as she wants offline and would only have to connect to the remote server to make or “pull” updates.

Git repositories usually consist of a single “.git” folder at the project’s root with a URL pointing to the location of the Git repository hosted on a server. Branching, tagging and a host of other functionalities are carried out via commands. Below is an example of a repository URL:

ssh://git@stacksharearticle.com/path/to/git-repo.git

SVN repositories, on the other hand, are organized into directories in which the main development line is known as the “trunk.” It also uses branches for changing context, and tags to mark certain versions. In order to traverse an SVN repository, URLs are used as shown below

svn+ssh://svn@stacksharearticle.com/svn/trunks

Both version control systems have a rich command line interface (CLI) tools for executing commands and carrying out operations, although Git has more commands.

Git has branching built as a feature directly into its core. With Subversion, branches may exist but as a practice and a workflow. They are just regular directories considered as branches (somewhat like glorified branches). For more information, see Using Branches in the SVN documentation.

Git’s branching feature enhances development, thus enabling each developer set up their own branch which is worked upon and fully tested before being packed up as a commit and eventually merged into the “master branch.” In some cases, developers even set up branches for bug fixes.

Learning Curve

When examining the barrier to adoption ( the learning curve) of Git and SVN, SVN tends to have the upper hand as Git has more commands and more concepts. Although both systems mostly embody the same functionality, SVN is a lot simpler and more straightforward for new developers.

Git, on the other hand, holds a little more complexity and might prove difficult for developers already used to working with SVN or other centralized version control systems, owing to the differences in mode of operation such as the staging area, synchronization process etc. However, a fitting solution for this may be to work with GUI applications that allow one to execute Git commands from a less complicated environment.

For developers who are proficient with Git, but may need to work on an SVN repository, an integration tool called git-svn exists. It allows a developer to track an SVN repository and make updates in both directions while operating Git locally. This allows the developer to access Git functionalities locally without distorting the project’s structure.

Performance & Speed

On the topic of performance and speed, things swing swiftly in favour of Git. This is owing to its distributed and cloned local repository structure. Developers can work anywhere even without internet access and still be able to make commits to their codebase which can be synchronized with the central repository later.

The elimination of a network connection as a requirement for carrying out basic operations makes branching a pretty instantaneous process in Git. On the SVN side of things, branch creation is slower as it requires Subversion to transfer files over the network.

Resilience

When working with SVN, there exists a single point of failure. As a result of the existence of a central server (repository) which manages all operations, a failure at this level results in the collapse of the whole system. In a large project, with many developers working collaboratively, if there’s a bug that breaks the build, then the development is brought to a halt and no more code can be committed to the repository until the problem is fixed.

The distributed structure of Git goes a long way in providing an architecture that is highly resilient in the face of failures and bugs. Since each developer has a local copy of the repository, an issue with the central repository doesn't stop further development on the project. Developers are able to continue making commits to their local repositories and can synchronize with the central server (repository) when the problem is fixed.

Integrations

SVN has existed for about 19 years now (at the time of writing this article) and has experienced remarkable growth in this period. Owing to this fact and its popularity, it has been integrated on most modern integration servers, Integrated Development Environments (IDEs), issue tracking systems and many other software development tools.

Git isn't lacking in this regard either. It has existed for 5 years fewer than SVN and only provides command line tools itself. However, it is easy to integrate with other software and many companies have created various platforms on it for the purpose of abstracting away complexities and for ease of operation. It is arguable that the most popular among such platforms is Github, others include SourceTree, Bitbucket and Jira.

Conclusion

Git and SVN are intrinsically different kinds of Version Control Systems by design. Fittingly, the choice of which to go with is highly dependent on the needs of the development team, its unique circumstances and the project type.

Git is fantastic for open source development as it is free and self-hosted, but in a context where the structure is hinged on having a central management structure, it may be a good idea to plug into SVN’s centralized version control features.

Further Reading

Below are links to articles that shed further light on the topic:

Git vs SVN (Subversion): What are the differences?

What is Git? Fast, scalable, distributed revision control system. Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.

What is SVN (Subversion)? Enterprise-class centralized version control for the masses. Subversion exists to be universally recognized and adopted as an open-source, centralized version control system characterized by its reliability as a safe haven for valuable data; the simplicity of its model and usage; and its ability to support the needs of a wide variety of users and projects, from individuals to large-scale enterprise operations.

Git and SVN (Subversion) can be primarily classified as "Version Control System" tools.

"Distributed version control system" is the primary reason why developers consider Git over the competitors, whereas "Easy to use" was stated as the key factor in picking SVN (Subversion).

Git and SVN (Subversion) are both open source tools. It seems that Git with 27.9K GitHub stars and 16.1K forks on GitHub has more adoption than SVN (Subversion) with 326 GitHub stars and 118 GitHub forks.

According to the StackShare community, Git has a broader approval, being mentioned in 3890 company stacks & 4630 developers stacks; compared to SVN (Subversion), which is listed in 77 company stacks and 58 developer stacks.

Decisions about Git and SVN (Subversion)
Kamaldeep Singh

SVN is much simpler than git for the simple stuff (checking in files and updating them when everyone's online), and much more complex than git for the complicated stuff (branching and merging). Or put another way, git's learning curve is steep up front, and then increases moderately as you do weird things; SVN's learning curve is very shallow up front and then increases rapidly.

If you're storing large files, if you're not branching, if you're not storing source code, and if your team is happy with SVN and the workflow you have, I'd say you should stay on SVN.

If you're writing source code with a relatively modern development practice (developers doing local builds and tests, pre-commit code reviews, preferably automated testing, preferably some amount of open-source code), you should move to git for two reasons: first, this style of working inherently requires frequent branching and merging, and second, your ability to interact with outside projects is easier if you're all comfortable with git instead of snapshotting the outside project into SVN.

See more
Get Advice from developers at your company using Private StackShare. Sign up for Private StackShare.
Learn More
What are some alternatives to Git and SVN (Subversion)?
GitHub
GitHub is the best place to share code with friends, co-workers, classmates, and complete strangers. Over three million people use GitHub to build amazing things together.
Bitbucket
Bitbucket gives teams one place to plan projects, collaborate on code, test and deploy, all with free private Git repositories. Teams choose Bitbucket because it has a superior Jira integration, built-in CI/CD, & is free for up to 5 users.
Perforce
Visibility, access control, workflow and code management for Git environments. Flexibility of collaborating on the same codebase and code reviews using any combination of Perforce and Git workflows and tools without compromise.
Mercurial
Mercurial is dedicated to speed and efficiency with a sane user interface. It is written in Python. Mercurial's implementation and data structures are designed to be fast. You can generate diffs between revisions, or jump back in time within seconds.
GitLab
GitLab offers git repository management, code reviews, issue tracking, activity feeds and wikis. Enterprises install GitLab on-premise and connect it with LDAP and Active Directory servers for secure authentication and authorization. A single GitLab server can handle more than 25,000 users but it is also possible to create a high availability setup with multiple active servers.
See all alternatives