Wednesday, January 8, 2020

Git vs Subversion

A version control system makes it possible to keep track of changes and go back and look at the history of changes.

It can be used for keeping track of your source code if you are a software developer.

Ten years ago Subversion was probably the most popular.

Today Git is probably the most popular, in part due to github where you can share your stuff with other people.

Here are the main differences:

Subversion:

  • Is a centralized version control system, where the repository is located on a server, and you pull down a working copy to your machine
  • All operations, like commit, branch, merge, happens on the server and require network operations
  • You have to pull the latest changes from the server before you can commit
  • The history on a given branch is linear
Git:
  • Is a distributed version control system, where the entire repository is both on the server as well as on the computers of all the users that are working on that repository
  • Many operations run locally on the computer of the user, for example commit, branch, and merge
  • You can commit locally a lot, even though other users on other computers have made commits on the same branch and pushed those commits to the server
  • The history on a given branch can become, well, branched, when multiple users are working on the same branch, or when merging changes from other branches
These differences mean that there are some benefits in using Git over Subversion:
  • Branching and merging and working on the same branch as other people is usually painless in Git, whereas simple branch and merge scenarios on Subversion could give a lot of trouble (well, even git is not idiot-proof: if you have been working on a branch for a long time without integrating your changes with other people, and if other people have made significant changes to the same files, then you might be in for a big surprise, and potentially a lot of rework, when you merge)
  • Git is just faster than Subversion (since many operations are local in Git)
  • You have the entire history locally, which can give you faster access
  • With Git you have several copies of the entire repository, making you less vulnerable to the server crashing
Here's a little example of how the history can look on a branch in git, after merging in changes from the master branch:

No comments: