Git: Keep file but ignore changes
Many repositories come with files that serve as templates, but shouldn’t actively be checked for changes. A good example of these is environment setup files, local config files etc.
To conveniently keep this base file in the repository, add and commit its template state as you would with any other file. Once this is done, tell Git to not track any further changes in this file:
git update-index --assume-unchanged local.env
To revert the configuration and track changes again:
git update-index --no-assume-unchanged local.env
See Git docs for more detailed information.