CVS - How do I love thee...

So, for a long time I was a SourceSafe devotee. There is nothing I would recommend more to a person to use, and always use, a good source control tool. However, my new job uses CVS pretty religously, so I needed to figure it out. It is defintely not as easy as SS, but, the more I use it, the more I like it. Plus, you can't beat the price (in other words, it's free.) For more information, see http://www.cvshome.org/.

My boss, David An, shared this tip today and I thought I'd pass it on...

CVS has the ability to auto-expand variables as files are committed. Thus, you can put the variable $Id$ (for instance) into a comment within your code, and it will be automatically expanded upon committing that file. This is great for quickly knowing which version of a particular file is in place.

So, my first file looked like this (it was a JavaScript file, should work for anything):

// here's a comment

I added the variable:

// here's a comment
// version info from CVS: $Id$

and committed it ... my file suddenly became:

// here's a comment
// version info from CVS: $Id: gotolink.js,v 1.5 2003/03/19 17:56:03 davida Exp $

and committed it again, to get:

// here's a comment
// version info from CVS: $Id: gotolink.js,v 1.6 2003/03/19 17:56:58 davida Exp $

Like This?

If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support. You can also subscribe to the email feed to get notified of new posts.