I have a ruby project, and the database host and port might be different on dev and production. I need a way to get different values for those into my scripts for the two environments.
The project should be complete – so there should be some way to specify default values. I don’t want a clone to be missing the config files. So ignoring them completely won’t work.
How do you solve this problem with git?
I would recommend using:
The Git solution is then a git attribute filter driver (see also GitPro book).
That way, the script (managed with Git) referenced by the smudge can replace all the variables by environement-specific values, while the clean script will restore its content to an untouched config file.
When you checkout your Git repo on a prod environment, the smudge process will produce a prod-like config file in the resulting working tree.