SVN Tip: Template Files

There are occasions when you want a file to be available under version control, but you don’t want changes to it to be committed accidentally. The file might be an example configuration file that will need to be edited differently for different tests, or different machines or for using a program in different ways.

For example, suppose there’s a file


required in some directory, and there’s a “canonical” version of that file. A build or run of the product requires that the file is edited, but you don’t want the canonical version affected.

If config.xml is added to version control, changes to it are likely to be accidentally committed.

One solution is to use “template” files. Thus a copy is made of config.xml and named according to some agreed convention. For example:


and that file is added to version control. Then to get SVN to shut up about your required, customised (but not version-controlled) copy config.xml, that name is added to the svn:ignore property for the containing folder.

This method may be extended in various ways.

If there are multiple commonly-needed variants of config.xml with different purpose, the templates might be named for example:


and if there are very many of these, then they should probably be located in a subdirectory called, say,

tmpl/ or

to avoid clutter.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: