mentalic
mentalic

Reputation: 996

Different files for different branches only locally

I have a git repository with two branches, eg master and customers I have a database parameters file called eg db_config.php This file must be different in both branches, but must never be 'pushed'. Can I achieve this with git?

The only think that I can think of is instead of changing the branch with 'git checkout master' I can create a bash command, that changes the branch and renames/copies the db_config.php (the files should be in .gitignore).

Upvotes: 0

Views: 39

Answers (1)

aross
aross

Reputation: 5799

One way of doing this is to put your db_config.php in .gitignore and create an file called db_config.php.example. Then when you deploy or send to your customer he/she would only need to copy the example to db_config.php file and insert correct credentials.

We often use similar behavior in our company where every developer has his own database settings.

Upvotes: 1

Related Questions