Using CVS to Update a Web Site - A Guide For Web Developers

The Problem

Let's say you're one of six people of varying skill levels working on a web site. After somebody else uploads a change, you notice the site is totally broken. Worse, you don't know who did it, and you don't have a backup of the files they changed. AAAAGH! Four hours of phone calls and cursing later, you have the web site working again. "There's got to be a better way," you say -- and there is. You can use a revision control system like CVS to tell who uploaded what files, exactly what they changed in those files, and revert the changed files back to good versions in minutes.

CVS - the Concurrent Versioning System

CVS is a program that acts like FTP with a built in backup system. It makes it easy to upload or download your whole site all at once, and helps you stay in sync with the changes your fellow team members are making to the web site.

It's free software, and runs on just about any kind of computer out there. The basic package consists of a program which is run from the operating system's commandline, but there are many graphical versions, including: WinCVS for Windows, MacCVS Pro or MacCVSClient for the Mac, LinCVS for Linux, jCVS for Java, and even versions you can use from a web browser. They are all versions of CVS, so sometimes people say "CVS" when they mean "WinCVS or whatever you have".

CVS is complex because it can handle very complicated situations; yet it's simple at heart, and most people using it to maintain a web site will never need to learn any of the tricky stuff. What follows is a quick guide to the essentials of using CVS on Windows.

Setting up WinCVS

Changing a page and uploading the change

Use relative links!

To preserve your ability to test your site locally, DO NOT use absolute links (e.g. "http://www.hostname.com/" or "/index.html") when linking to another page on the same site. Instead, use relative links (e.g. "index.html" or "foobar/bletch/index.html" or "../index.html" -- i.e. not starting with http:// or a slash).

See also HTML Tips: Relative v. Absolute Pathnames, How to Use Links Effectively: Absolute vs. relative links

Avoid destructive tools!

Caution: don't use any editors such as Microsoft Front Page or Microsoft Word that modify the whole file every time you open it -- that makes it very hard to see what has changed from version to version of a file, and causes trouble if two people edit the same page concurrently. (It's hard to merge overlapping changes.)

See Also

If you have trouble, or want to read further, more documentation for WinCVS is available at www.wincvs.org/doc.html.

My guide for setting up a CVS server may also be interesting to advanced users.

http://cdx.sourceforge.net/win-HOWTO.htm documents how to set up SSH and CVS on Windows.


Last updated: 28 November 2000
Copyright 2000 Dan Kegel

[Back to CVS]