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

Git

285.2K
172.2K
+ 1
6.6K
SVN (Subversion)

788
618
+ 1
43
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?

Introduction

Git and SVN (Subversion) are both version control systems commonly used in software development to manage and track changes to code. While they serve a similar purpose, there are key differences between the two.

Key Differences between Git and SVN

  1. Distributed vs Centralized: Git is a distributed version control system, which means that every developer has a working copy of the entire repository. This allows for more flexibility and offline work. On the other hand, SVN is a centralized version control system, where there is a single central repository that holds all the code. Developers have a local copy of the files but need a constant connection to the central repository for most operations.

  2. Branching and Merging: Git makes branching and merging of code much easier compared to SVN. Git allows for lightweight and quick creation of branches, which is useful for experimenting with new features or separating code for different purposes. Merging branches in Git is also faster and more efficient. In SVN, branching and merging can be complex and time-consuming, often requiring server interaction.

  3. Repository Structure: In Git, the entire repository, including the full history and all branches, is stored in a single folder on the local machine. This makes cloning and copying repositories faster and easier. In SVN, each project has its own separate directory in the repository, making it harder to manage and copy the complete repository.

  4. Performance: Git tends to have better performance compared to SVN, especially for operations like committing changes, branching, and merging. The distributed nature of Git allows for local operations, reducing the need for network communication with a central server. SVN, being a centralized system, often requires interaction with the server for most operations, resulting in slower performance.

  5. Conflict Resolution: Git has more advanced and powerful tools for handling conflicts that occur when multiple developers make changes to the same file at the same time. Git provides interactive conflict resolution options and allows for cherry-picking changes from different branches. SVN, on the other hand, has simpler conflict resolution mechanisms, which may require manual intervention or intervention from the server.

  6. Revision Numbers: SVN assigns a unique revision number to each commit in the repository, which is globally incremented. This allows for easy tracking of changes and providing a linear history. In Git, each commit is identified by a unique hash value, which provides a more distributed and non-linear history. While Git provides more flexibility with commit identification, SVN's revision numbers can be useful for certain types of reporting and tracking.

In Summary, Git and SVN differ in their approach to version control with Git being a distributed system, providing better branching and merging capabilities, a different repository structure, improved performance, advanced conflict resolution, and a different method of identifying commits.

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 StackShare Enterprise. Sign up for StackShare Enterprise.
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