In a config file for a PHP project, I have some settings that should not go out in production. Can anybody offer some specific examples or help on how to automatically check these fields and make sure their values are not the development/demo settings before the files get committed into subversion?

Our IDE is JetBrains PHP Storm, and we use the latest version of subversion. Some of us develop on Linux, while others are on Windows.


This shouldn't be handled by SubVersion but by build script.

This script should modify or replace development settings into production one during the release process (if automated).


We use a sample config file which is added to the repository. The used config file is ignored by subversion and will/can be changed by every developer. If the developer adds something there, he must add the default value to the sample, too.

Changes to the config file used in the productive system has to be done by hand. To enforce that the production config get the changes that are necessary, we have created a checklist for the deploy process which needs to be followed. The deploy is done by a pair of developer, just to make sure we have 4 eyes on the process...


I have a configuration directory with one subdirectory for each sort of installation, e.g. development, demo, production, test, etc. Deployment of a new version is done in three steps:

  1. Checkout

    svn co ...

  2. Configure and build

    ant configure -Dconfiguration=production

    This copies files from the configuration subdirectory into the appropriate location, and builds the application

  3. Install

    cp myapp ...


Well, this answer is correct, this isn't a job for the SCM.

But, in reality we all put up with stuff that's not ideal so... what you want is to put a call to grep in your pre-commit hook (or a perl script that does a regex). You must pay particular attention to getting your regex unique to the config files, even to the point of only checking those files with the relevant names. (otherwise you may end up rejecting a perfectly good file - some documentation for example)

If the regex matches lines that only exist in your dev/demo config files, then write a quick error message to stderr and return 1. SVN will handle the rest for you.

Not the answer you're looking for? Browse other questions tagged or ask your own question.