I\'m using git for a personal project at the moment and have run into a problem of having one codebase for two different environments and was wondering what the cleanest way
I think it is too late for the .gitignore solutions.
I would :
...is not commit environment specific files via .gitignore
.
In CodeIgniter this means
.htaccess
database.php
config.php
That's about it.
Depending on how your application is setup this can have differing effects. Mostly I will have say config.example.php
and example.htaccess
which I will commit. Then if I have to setup an environment I will modify those and rename them in the process. Because they are ignored by git you don't have to worry about it.
If you have lots of environment specific code then you need to rethink the layout of your application.