= Setting the $Id$ Tag in Subversion = CVS will automatically set an ''$Id$'' tag in each file; it looks something like this: $Id: test.php 110 2009-04-28 05:20:41Z dordal $ This is super-helpful for two reasons: * it lets you know at a glance what revision of a file you're working with, and who last worked on it * if you export your code (say as part of a deployment process), it lets others know what revision of a file they have Subversion, by default, doesn't add these tags. However, you can configure it to set the tag when you checkin a file. **Note that this configuration has to be done //client side//; unfortunately you [[http://subversion.tigris.org/issues/show_bug.cgi?id=1974|can't set this on the svn server for all clients]].** If you have multiple developers, you'll need to be pretty strict about making sure they all go through this procedure. == Configure subversion to automatically add the $Id: $ tag == First, update your ''~/.subversion/config'' with the following info: [miscellany] enable-auto-props = yes [auto-props] *.php = svn:keywords=Id *.js = svn:keywords=Id **NOTE:** You may want to add additional file types to the list above. As it stands, it will only set $Id: $ tags for ''*.php'' and ''*.js''. == Set props on existing files == That configuration will automatically apply the ''svn:keywords'' property (which sets the ''$Id$'' tag) to all //new// files. But what about existing files? For these, you'll have to set the property manually. Go to the root of your source tree, and run this command: find . \( -name "*.php" -o -name "*.js" \) -exec svn propset svn:keywords Id {} \; ''find'' will return a list of all ''.php'' and ''.js'' files, and then run ''svn propset'' on them to set the appropriate ''svn:keywords'' property. Now, all files have the property set, and will automatically set the ''$Id$'' tag on checkin. == Add the $Id$ tag to each file == Finally, go through each file and add the prototype $Id$ tag. I like to do this in the comments at the header of each file, e.g.: /* * @author David Ordal, david -at- ordal.com * @version $Id$ * */ When you checkin the file, you'll see it expand to: /* * @author David Ordal, david -at- ordal.com * @version $Id: test.php 110 2009-04-28 05:20:41Z dordal $ * */ That's it!