I've got a config file,
site.conf, that contains Production settings.
I do not want to track my local updates to it. So, here's what I do:
git update-index --assume-unchanged site.conf
Now I update this with my local database settings, etc.
However, when I try and check out a different, local branch I get the following message:
error: Your local changes to the following files would be overwritten by checkout:
Please, commit your changes or stash them before you can switch branches.
What am I doing wrong?
You are switching between branches that differ in their
site.conf contents. Git will not apply the changes for you: you've been telling Git that your
site.conf is unmodified, but Git detects the unexpected local modifications rather than silently overwriting them.
You can either make sure your
site.conf is identical in both branches, or forcibly overwrite
site.conf and reapply your local changes manually.