2

This question How do you deal with configuration files in source control? suggest to ignore them, and while it is an alternative I don't really want to have them moving the .ignore file all that much, seems like dirty to me.

Most of the team members have some sort of configuration in a number of versioned files which are not to be committed to the main branch. ie. app.config file with the local database etc.

How to deal with these files? They need them to have their environments running but at large they tend to forget to add new files to the repo because they start ignoring modified files.

I was thinking have some sort of script the removes them from the local file system when they compile so they can tell if the whole solution will stil compile or not when pushed into the repo, but I wonder is there is a better solution?

Community
  • 1
  • 1
OscarRyz
  • 184,433
  • 106
  • 369
  • 548
  • You've already found the [same question](http://stackoverflow.com/questions/6009/how-do-you-deal-with-configuration-files-in-source-control) and even if you don't like the solution presented there, I don't think we need another question about this topic. Maybe you can add a comment to the answer you don't like there instead? – Martin Geisler Apr 26 '12 at 07:20

1 Answers1

1

I'm not sure what you mean by "don't really want to have them moving the .ignore file all that much", but you should stick with the advice you originally found and put files that shouldn't be added in the ignore file as intended. That's what it's there for and there's no harm at all in filling it with files that not everyone will have.

Some other tools you can employ are:

  • commit a template for the config file (for example config.sample) and have your build script do a copy from config.sample to the ignored config if (and only if) it doesn't already exist
  • enhance your configuration system to include overlays. For example config.local, which is ignored, overrides settings loaded from config.shared which is tracked.
  • enhance your configuration system to allow for includes. For example a line like %include ~/settings which people can put their own config into

All of those, however, presuppose you're ignoring a config file which varies by user, because that's what you should do. :)

Ry4an Brase
  • 77,054
  • 6
  • 143
  • 167