Although this is not an official way, it is a workflow that we use:
Rename and add add .exampleto the end of the file name.
Add the actual file name to your .gitignorefile (and commit the file .gitignore).
Copy the file locally to the copy that has the actual file name (now ignored).