I ran into this issue today: Dealing with conflictive files/directories in projects using Subversion. For example: Log directories and configuration files. But I’ve seen this problem before in my projects. I really like working in teams. But I also like having my own work environment.
I don’t really like sharing the database I use for development with other people. I guess it’s because of my experience and many past headaches due to teammates introducing conflicting changes (the system starts failing, ‘magically’)
This is a good practice suggested by Subversion: Use .tmpl files for conflictive resources in your projects. In my Rails projects, the conflictive file is usually database.yml -
My teams like to work with a development database in the Aycron office. I like to work with a local database. I believe it’s faster and safer. I save time by using my local MySQL database.
Here is what you should do, in order not to share the same database.yml:
1. Create your Rails project structure
[etagwerker@benteveo trunk]$ rails test-local -d mysql
2. Rename database.yml to database.yml.tmpl
[etagwerker@benteveo test-local]$ cd test-local
[etagwerker@benteveo test-local]$ mv config/database.yml config/database.yml.tmpl
3. Commit all your code to the SVN repository
4. Create your local copy from your template
[etagwerker@benteveo test-local]$ cp config/database.yml.tmpl config/database.yml
5. Ignore database.yml for the rest of your project
[etagwerker@benteveo test-local]$ cd config
[etagwerker@benteveo config]$ svn propset svn:ignore database.yml .
6. Commit the config directory
[etagwerker@benteveo config]$ svn ci
You’re done! Your teammates can do whatever they want with the database.yml, you can do whatever you want and there will be no conflicts over that file. Because it will never get committed to the SVN repository.