Version Control and Web Development

Tweet

CVS, or the Concurrent Versions System, allows for a robust version control system to be in place to insure control over changes to a web site as it is being designed and developed, during testing and qa and post-production during content management and improvements.

While there are many web developers using cvs, it is mostly known for its use in software development projects. However, conisdering the dynamics of the 21st century web site, and the proliferation of web applications, cvs should be a consideration even for the independent developer who occasionally uses sub-contractors for projects.

CVS, found here, is generally already installed on your *Nix servers, including OS X. Clients are available for numerous platforms (Windows, Macintosh and *Nix), and are built in to some web development IDEs (such as Macromedia Dreamweaver). The CVS home also includes extensive documentation on how to use cvs on your server.

There are three pieces to getting started on a cvs project:

1) If starting a new cvs repository with existing files, you should do a master backup of the code, import it into a new cvs tree, and then delete the old directory. This insures you will not accidentally edit cvs and non-cvs files.

2) If starting with a new project, decide on the structure of the filesystem first. For example, for a new client at www.newclient.com, you setup a development, staging and production environment. These would be on the filesystem as:

A) /home/sites/www.newclient.com/htdocs/ (for www.newclient.com in production),
B) /home/sites/staging.newclient.com/htdocs/ (for staging.newclient.com where all finalized code is tested prior to release to the production site,
C) and /home/sites/devel.newclient.com/htdocs/ (for devel.newclient.com, where all of the true design and development takes place.)

3) Once setup and tested, insure those participating in the development work have a client properly configured. Clients for Linux, Macintosh and Windows can be found at CVSGui.

The key benefit of using cvs is obviously source code control, and that includes auto-version control, with version numbering (v 1.0, 1.1, 1.2 and so on) and the critical feature of rollback, which allows you to rollback changes that have been put into place but are failing to meet a standard, or if a hidden bug is discovered.

Free book: Jump Start HTML5 Basics

Grab a free copy of one our latest ebooks! Packed with hints and tips on HTML5's most powerful new features.

  • anubishh

    Thanks for this very informative BLOG.

    I suppose you need to create virtual hosts for staging, devel, and live site. My question is, does anybody know a good tool to create those hosts, i don’t want to play around with apache conf files alot.

  • UCAP

    The link to WinCVS should be wincvs.org and not .com ;-)

  • http://www.practicalapplications.net bwarrene

    [QUOTE=UCAP]The link to WinCVS should be wincvs.org and not .com ;-)[/QUOTE]

    Thanks- I actually typo’d that one as it is a Safari bookmark for me. Just in a .com state of mind today. Appreciate you pointing that out to me – it is corrected.

    Blano

  • http://www.practicalapplications.net bwarrene

    [QUOTE=anubishh]Thanks for this very informative BLOG.

    I suppose you need to create virtual hosts for staging, devel, and live site. My question is, does anybody know a good tool to create those hosts, i don’t want to play around with apache conf files alot.[/QUOTE]

    Under the free and open source banner – my recommendation is Webmin as it provides a GUI interface in browser to Apache but still permits access to root level config files if needed.

    Webmin (http://www.webmin.com) is installed on a *Nix server – and can be accessed from any platform in just about any browser.

  • http://aplosmedia.com/ Eric.Coleman

    If you don’t want to use CVS, and want to have some sort of web based version control, WEBPM is an excellant project that’s still being developed. Sure, there are still bugs, and the site is german (once you download, install it, and login, you can switch to english). I would check it out:

    http://webpm.woltlab.info/

    - Eric

  • pippo

    Also you can browse your repository by using cvsweb.

    I’m evaluating to use a repository to store my C/C++ projects,
    but I admit that I’m tempted to use subversion in place of cvs.
    One of the best advantages, from my point of view, of subversion versus cvs are:

    a)
    Copies and renaming files seem better under subversion.
    In most cases with CVS you will loose the files history.

    b) (I read that of)
    Better binary file handling, it is usefull when you have to work with a lot of images such under web development.
    In fact with cvs if you commit 100 modifications to an image file, the remote repository will have 100 copies of the same file….what a waste of space.
    Subversion uses an internal algorithm to handle binary files, so in pratice it does not store a new copy of an image when you commit a modification.
    Only differences are send.
    In pratice binary files are handled the “same way” as text files,
    more or less…. ;)

    I used CVS and Subversion for few days only, so point a) is not that clear to me.
    Point b) is something that web developers should think of.

    IMHO, CVS seems more fine, with some limitations, to text-only projects.
    For a web-development, due to lot of images, I’d try subversion.

    There exists an Apache module for subversion, but it works under 2.x.
    The reason seems due to web_dav support of 2.x series.

    CVS is a more stable and mature product, though.

    Many CVS competitors, such as subversion, offer the import of an existing CVS repository,
    so starting with CVS would let you to switch to another version control “easily”…if you evaluate that CVS doesn’t do something you need.

    Last but not least, the Linux and MySQL projects are using bitkeeper but the main issue is its license….but I never read in deep that.

  • http://www.practicalapplications.net bwarrene

    As a follow-up, I also wanted to note RCS, a revision control system that is also optimal for revisions of text and graphics. It is found at http://www.gnu.org/software/rcs/rcs.html and could also serve as a simplified solution and alternative to cvs.

    Not to say cvs is not appropriate for web developers, but for simply controlling the revisions of web pages, source code and images, RCS could serve well.

    I would still encourage web development environments with multiple developers and designers and perhaps even numerous “content updaters” to consider evaluating and experimenting with cvs. It would be the most robust and mature of those available.

    Bitkeeper does have a good reputation as well.

  • http://www.thenewzealandsite.com xor

    The basic information here is good, especially 2A, but there isn’t really much about the process of doing web development with version control. On a day-to-day level, what do developers do? Do they have servers running on their local machines or do they check out – change – check in before being able to test their changes on the development server? We are looking at implementing version control, but the real challenge for us is that we are not allowed to run servers on our local machines. We don’t want the version control system to bog us down while doing development, forcing us to go through extra steps (checking back in before we test) each time we make a small change and want to test it. I haven’t been able to come up with a workflow yet that incorporates version control and is still streamlined enough. I’d love to hear more from web developers who are actually using version control… how have you implemented it? What are your workflow stages?

  • http://exotic4.nipne.ro/~iacobs/ m0n5t3r

    Samba exported sandboxes, each with its own virtual host (I use dynamic vhosts, so I only need to make sure it is resolvable), since the development takes place in an intranet… for remote development, 2 choices: sandboxes on the main server accessed via FTP, SFTP or WebDAV, or local server (much faster, but one needs to replicate the database, too, if the project is using such a thing). As for the graphical clients, lincvs or smartcvs are good choices.

  • Anonymous

    Keep in mind that CVS uses RCS as its ‘backend’