I'm starting to question if I'm following best practice on my Git strategy between master and dev since deployment is not as straight forward as it seems it should be.
I have a master and dev branch that have some environmental differences. In most places where it is a configuration difference (i.e. connection string, app setting, etc.) I have been able to abstract these different into environment configuration files which live outside of Git. When switching from master to dev, the developers on the team copy and paste in the correct environment configs and everything works correctly.
However, there are some places where the code itself differs between master and dev. The most concrete example of this is within the Ninject (DI) configuration file which differs between using the production Email Service and the development one so customers are never accidentally emailed.
We've considered using the #if DEBUG
preprocessor but this wouldn't protect against a developer running the dev branch in "Release" mode.
This difference in code across branches becomes difficult to manage when merging dev into master because each time we find ourselves manually ensuring the master code is never overwritten. To aid in this we ended up creating a "merge" branch which is already set up with the production commits and ignores the conflicting dev commits.
The issues becomes keeping all these branches in sync and merging / issuing pull requests in the correct order to ensure the correct code is merged.
If possible, can someone suggest a better "strategy" on managing these branches so deployment is as simple as merging dev into master?