You can set the skip-worktree
flag for restricted files like this:
git update-index --skip-worktree path/to/the/file
That gives a little different effect from what you need, but provided proper convention within the team, it should pay off: skip-worktree
makes git ignore any local changes made to a specified tree (files), so no matter if your teammates change it or not, git does not track these changes. However git still tracks remote changes, so git pull
command will update content of the files.
The main disadvantage is that this flag should be set locally on all machines you need those file local changes to be ignored on. For the machines you going to have possibility to push those files, just do not set this flag, or unset it with the following command:
git update-index --no-skip-worktree path/to/the/file