views:

896

answers:

6

What's are the best practices for versioning web sites?

  • Which revision control systems are well suited for such a job?
  • What special-purpose tools exist?
  • What other questions should I be asking?
  • etc...
A: 

Source control for web projects

Chris Upchurch
+3  A: 

Firstly you can - and should - use a revision control system, most will handle binary files although unlike text files you can't merge two different set of changes so you may want to set the system up to lock these files whilst they are being changed (assuming that that's not the default mode of operation for you rcs in the first place).

Where things get a bit more interesting for Websites is managing those files that are required for the site but don't actually form part of the site - the most obvious example being something like .psd files from which web graphics are produced but which don't get deployed.

We therefore have a tree for each site which has two folders: assets and site. Assets are things that aren't in the site, and site is - well the site.

What you have to watch with this is that designers tend to have their own "systems" for "versioning" graphic files (count the layers in the PSD). You don't need necessarily to stop them doing this but you do need to ensure that they commit each change too.

Other questions?

Deployment. We're still working on this one (-: But we're getting better (I'm happier now with what we do!)

Murph

Murph
+2  A: 

I use Subversion. As an easy way to reference the website version (production, testing, development), I use a very simple trick. I add the revision number somewhere on the site (eg in the admin footer). Something like this:

<?php print("$Revision: 1 $"); ?>

Each time you checkout (development versions) or export (for production), the "1" will be replaced by the revision number in your repository, thus making it easy to setup the customer version on your test server, for example.

Christian Lescuyer
+3  A: 

In response to Christian Lescuyer's post, you also need to enable the "svn:keywords" property on the file with that line in it. Subversion won't bother looking in your files for keywords like $Revision$ unless that property is set.

Also, if using PHP like in his example, you may want to put $Revision$ inside a single-quoted string instead of a double quoted string to prevent PHP from trying to parse $Revision as a PHP variable and throwing a warning. :)

Bob Somers
A: 

@Bob Somers

Oops, double oops! Couldn't find the actual code and goofed. Thanks for the correction.

Christian Lescuyer