Search code examples
gitgitignore

Stop git from tracking temporary open Microsoft Office files


Microsoft Office makes copies of open files, say when you open abc.xlsx Excel creates a file called ~$abc.xlsx, prefaced with a tilde and dollar sign.

When I open an Excel file in my git repository to look at the data, git tracks the new file as a change and I have to take care to avoid committing it. How can I use a .gitignore file to skip tracking these files?


Solution

  • Add a new row to your .gitignore file containing ~$*. That will ignore any files beginning with ~$, the prefix for temporary Microsoft Office files.