I\'ve inherited a project and we are using git. We have a number of environments (dev, test, prod). The previous team basically recreated everything on each instance, using
It sounds like you should read up on git attributes. Check out the section at the bottom of this page
This is helpful if a branch in your project has diverged or is specialized, but you want to be able to merge changes back in from it, and you want to ignore certain files. Say you have a database settings file called database.xml that is different in two branches, and you want to merge in your other branch without messing up the database file.
As you already said, storing the config settings inside your code isn't a good idea. Especially, your developers shouldn't even know the credentials for the production database, in my opinion.
What we do here is that on each server we have predefined environment variables pointing to a configuration file that has the necessary credentials. Since we are using Java here, this is a file like database.properties
and this file is never inside a version control system.
This also makes it possible to have different settings and different credentials on each server