views:

334

answers:

3

how does version control usually work? does it save diff files as a trail with hashes to validate the trail?

+8  A: 

Check out Eric Sinks blog series on version control.

Also, Joel Spolsky wrote Hg Init: a Mercurial tutorial, that finally made me "get" what distributed source control is all about.

There are more than one ways to skin a cat...

Daren Thomas
+2  A: 

Different VCS use different approaches. CVS, for example, will create a file on the server for each file which you commit. This is essentially a file in RCS format; CVS is only a wrapper around RCS which runs the RCS commands over many files in a directory subtree (RCS can only work on single files).

The RCS file contains a list of changes (version number, checkin message and how much was changed). After that comes a copy of the current HEAD version. The rest of the files are the diffs between the versions (long explanation).

This way, CVS can quickly return the HEAD version (which is most often requested) and it can compute the other versions.

CVS doesn't do any validation; if one of your files becomes corrupt, you need a backup. Since CVS is based on RCS, it can't version directories nor can it track renames. CVS and RCS use the standard diff(1) command to create the diffs.

Subversion (SVN) works similarily but adds versioning of directories and renames. Moreover, SVN uses a better diff algorithm (xdelta) which gives a smaller repository.

For an explanation how Git works, see here.

Aaron Digulla
A: 

Darcs is very different and IMHO more intuitive than other SCMs even distributed ones. There's an excellent guide for beginners about how it works: Understanding Darcs.

lispmachine