There\'s a special place in hell for people who hardcode absolute paths and database credentials into multiple random places in web applications. Sadly, before they go to he
A technical (Git) solution would be using git attributes, using the attribute merge.
merge
The attribute
mergeaffects how three versions of a file is merged when a file-level merge is necessary duringgit merge.
You will find in the SO question "How do I tell git to always select my local version for conflicted merges on a specific file?" an example of using such an attribute, to force keeping the local version of certain files when merging to a given branch.
The problem with setting merge attributes is that the files that contain the paths may contain other changed code, which I want merged
Do not forget you can associate any kind of script to manage those merges through git attributes. That include a script able to keep changes you want local, while merging the rest. It is more complicated to write such a "merge manager", but it is a way toward an ad-hoc automated solution.
A less-technical solution would be to separate the configuration values from the configuration files:
A script is used to replace the name in the actual config file by the values of one of the config values files needed for a given environment.