This is very similar to this question, but I'd be interested in knowing how to ignore a committed git file for some branches but not for others, or to find some other solution to my problem.
We have a config file that differs for each customer. We track this in git using a branch for each customer. Likewise, each developer has his own custom development environment which requires a unique config file.
I created a branch for my environment and tried using git update-index --assume-unchanged [path]
(from this answer) but realized that although it ignores the changes in my branch, it never updates the file when I change branches. This works perfectly well for changing to another developer's branch, but if I were to change to a customer's branch, I need the config file to change since I want to point the code to their database, e.g.
Is there a way to ignore the config file for some branches but not for others?
If not, I've thought of a couple of alternative approaches, but each has its disadvantages:
- Before switching customer branches, run
git update-index --no-assume-unchanged
. This works, but I know I'm likely to forget this and it may not be immediately obvious that the wrong config file was used. - Don't use
git update-index
at all and change the config file back to my settings after switching developer branches. I'm also likely to forget to do this occasionally.
Thanks for any other ideas.