We have a team of 5 developers working on a hardware project. We have a user_config.h file containing #defines for each user's specific environment and preferences - eg what hardware version they're using, whether sound should be turned on etc.
Presently, the file is in our .gitignore file, which works well enough. Users can make changes to their settings that don't get pushed. It was previously tracked and has been rm --cached on master branch.
Occasionally we switch to an old branch that didn't have the file, and it gets deleted. The user then has to get someone else to email them a current user_config.h file. We'd like to stop this from happening.
Bonus points: What I'd really like is to have the file tracked, but ignore user changes. Occasionally, the project leads need to add settings to this file when new features are added, so we'd like those changes to be pushed to all users. And if a new user checks out the repo, we'd like them to get the "factory default" settings, which would also be good to change from time to time.
So, ideally, we want to ignore changes to any line of the file, but accept changes where lines are added or deleted. Preferably with the ability to temporarily turn this off so we can change the defaults, (even if this means editing the file directly in github or something like that), overwriting what's on the repo but not users' changes.
Is there any way in git that we can achieve all of this?