dark mode light mode Search Menu
Search

Version Control Software

boboroshi on Flickr

Imagine you have worked on your code over months only to find you need to recreate a chunk of code you created a few weeks before. How would you find your code and add it back?

If you’re lucky, you save your code every day in date-stamped folders. But that also leaves you with many folders with the same code. And you might have written your function in the morning then deleted it a few hours later the same day.

Version control software takes an evolving set of snapshots of code over time, as well as playing traffic cop to manage changes. The function you wrote then deleted might be saved to a branch (or copy) of code, tested, then merged into the code base. When you remove the function code later, the history of your changes remain for later recovery.

While mostly used by teams of developers, version control also works for individual coders as a way to track code changes.

There are two styles of version control software:

  • Centralized Version Control Systems maintains code at a central location and strictly tracks changes made to the code. A centralized system can be less flexible but work fine for many coders.
  • Distributed Version Control Systems (DVCS) track a code base and changes to the code at the lowest levels to provide coders an easy way to code small or experimental changes without bothering others using the software.

There is no 100% correct answer to the question, “What is the best version control software?” Coders who start from scratch with a code base often can choose what they want based on their needs. In large corporations or established shops, coders join the company and use the tools provided, including version control.

Some key concepts used in version control software:

  • Branching — The ability for coders to create a unique version of their code base, called a branch, allows coders to work on small pieces of code then merge their branch into the full code base once they’ve tested their changes. Distributed version control systems allow more flexible branching while centralized systems make branches public.
  • Locking — In some version control software, working on a file or folder triggers a lock to prevent changes from other coders. This enforces the integrity of the code base.
  • Baseline — The baseline for a set of code changes over time as branches are tested, approved, and merged into the code base. Sometimes a baseline is called a build. There can be multiple baselines, for example, a production baseline for the code currently available in public and a baseline for the next software release.
  • Merges — When a branch has passed testing, it can be merged into the code base. The version control software manages any conflicts.
  • Commits — Part of the merge process includes a command to commit the changes with a short message to describe the changes.
  • Push and Pull — When software code is checked out from the main code repository, you pull the code to your computer. When you’re made your changes, you upload or push the code changes upstream to the code repository.

The ability to branch, and controls imposed on branching, are one of the more dangerous aspects of code management. Fifty coders working on many branches can create a nightmare for the version control software to manage. Whether a centralized or decentralized control system is used, care must be taken when branching and allowing branches.

While the oldest version control software is CVS, other software is more commonly used and more likely to be encountered by programmers.

Subversion (svn)

Subversion is the primary choice for centralized version control. It stores the code base in a central location and imposes strict controls for branching and locking. This works well for groups in one location or geographic area. However, centralized control over a network and continents might pose problems with slow updates. Subversion also works well with binary files, for example, Word or Powerpoint files as well as software code. And while many (most?) open source software projects use Github, some projects like WordPress use Subversion.

Mercurial (hg)

One of the two main distributed version control software systems (Git is the other), Mercurial manages code across locations and changes at a low level. Branches, merges, and commits are pushed upstream to ensure the code base is kept in synch. Mercurial also allows cloning as part of branching. While Mercurial is considered less powerful than Git, especially with Github as an interface for Git, Mercurial has gotten a lift from Bitbucket, Google Code, and Microsoft’s Codeplex which use their software.

Git

The main complaint about Git is its complexity, usually mentioned immediately after its power. Git commands can be obscure and require research and lookup. However, there is a lot of power built into the software. Git also requires a different mental model to understand how it controls versions of software. This appeals to coders who want to understand the internal workings of their software. Coders who simply want version control sometimes prefer Mercurial for a distributed version control system.

Github

Github is a project management and version control system for software development projects. Their interface makes Git more usable than using command line software, although commands are needed to push software from your computer to Github. There are so many public projects on Github, it is easy for coders to fork a project to their account and code changes with pulls and pushes to the code repository. Project managers then approve any changes. Projects can be public or private.

Unfuddle

In addition to the big boys and girls of hosted software version control, there are services like Unfuddle that provide the same or similar features as Github. Unfuddle works especially well for private projects where the open public exposure of Github is not required. The service includes version control software and project management tools.

Learn More

Version (Revision) Control Software

http://en.wikipedia.org/wiki/Revision_control
http://en.wikipedia.org/wiki/List_of_revision_control_software
http://en.wikipedia.org/wiki/Comparison_of_revision_control_software
http://www.smashingmagazine.com/2008/09/18/the-top-7-open-source-version-control-systems/
http://martinfowler.com/bliki/VersionControlTools.html

Subversion (svn)

http://subversion.apache.org/

Mercurial (hg)

http://mercurial.selenic.com/
http://mercurial.selenic.com/wiki/UnderstandingMercurial
https://bitbucket.org/
http://code.google.com/
http://www.codeplex.com/

Git

http://git-scm.com/

Github

https://github.com/

Unfuddle

https://unfuddle.com/

CVS (Concurrent Version System)

http://www.nongnu.org/cvs/