This article provides an overview about why to use version control. It also compares Git vs. Subversion (SVN); two of the major version control systems. This article is for you if you are new to using version control and trying to decide between using Git and Subversion.
What is Version Control?
Have you ever found yourself saving multiple versions of files like so:
That is a basic yet inefficient example of version control. It is a quick way to confuse oneself and frustrate others.
When working in teams, more sophisticated version control is needed.
Why Use Version Control?
Version control offers many benefits including:
- save entire history of your project
- make mistakes with less fear
- experiment freely
- teamwork becomes more manageable
In short, version control is like an insurance policy that allows you to take risks while ensuring you always have a backup of your original files.
What are Git and SVN?
Git and SVN are two of the most popular systems for version control. The rest of this article will look at the pros and cons of each system
In the past few years, many developers have been moving away from SVN and towards Git.
The Benefits of Git
Git has become the industry standard in web development. It is preferred to SVN because:
- Git is distributed
- Git is faster
- Git has smaller repository size
- Branching and working with teams is easier
There are many more reasons Git is recommended over SVN, but lets dive a little deeper into the main reasons.
Git is Distributed
With SVN you check out subtrees from a repository. Git requires you to check out the entire repository. This ensures every person working on the project has the entire history of that project.
Each member on the team has the entire Git repository stored locally on their computer. This ensures there are always multiple complete histories of the entire project stored in multiple places.
Each member on the team has the entire Git repository stored locally on their computer
Having the repo stored locally also makes Git faster than SVN which requires network communication to get file information and backups.
Git is Faster
Since Git is stored on your local machine, you can do almost everything you need offline. This makes committing, branching and merging files extremely fast. SVN requires a network connection which can slow you down.
Git Has a Smaller Repository Size
SVN includes two versions of the same file. One version is hidden and is used to help with SVN functions. This extra size required by SVN can add up on a large project that contains many files.
Branching and Working with Teams is Easier
Git makes branching much easier than SVN. This means you can more freely experiment with new ideas. With Git, you can quickly (and locally) create a new branch of your repo. You can do some work on that branch and then merge it or delete it.
Git makes branching much easier than SVN.
Git is generally able to figure out the best place to merge commits. SVN requires you to figure out what needs to be merged with what. This can be confusing and can lead to serious mistakes.
Benefits of SVN
SVN has some benefits over Git. Some people find its way of numbering repositories to be more intuitive than Git. This can make it easier to return to previous versions. Since SVN has been around longer, there are more Graphical User Interface tools if you want to avoid the command line. There are, however, plenty of Git tools as well, so this shouldn’t be a big deal breaker.
Since Svn is a centralized version control system, everything is stored in one place. This can make some feel that SVN is less confusing than Git.
Git proponents would argue that Git is perfectly capable of creating a similar centralized workflow in which it is just as easy to locate and access main branches and files.
Git’s decentralized and local workflow make it a faster and more insured way of backing up your projects and files. The ease of creating Git branches encourages greater experimentation and innovation.
While both tools are better than the
wireframe-absolute-final.html naming convention, Git has become the preferred industry standard for its speed, small file size and multiple sources of backup.