Reputation: 1831
I have a app.yaml and php.ini file that has a different set of configurations for staging and production.
I want to create 3 separate branches. 1) Local, 2) Staging, 3) production.
The problem is that if I branch and create different files for each environment one settings will be overwritten by the other when I perform a merge. For example, when I merge my staging branch into production the config file will now contain staging settings and will not work in the production environment.
How do I get around this issue while keeping track of the changes of each file in individual branches through git. I do not want to add the config files to .gitignore.
Upvotes: 0
Views: 56
Reputation: 4314
I would suggest having the settings as environment variables, I steer away from publishing my secret keys and other production settings to git. Each environment can have their own distinct settings
Upvotes: 1
Reputation: 1438
This isn't really a practical usage of git. What I would recommend doing is writing the file in a way that says something like:
IF 'Local' Then
...
ELSE IF 'Staging' Then
...
ELSE IF 'Production' Then
...
ELSE
...
END IF
Instead of having a separate file for each branch.
Upvotes: 0