How to make git ignore temporary files created by MS Office (starting with ~$)

Viewed 3863

My git repo includes MS Office files (Word, PPT, & Excel), each time I open one of them a temporary file starting with ~$<file-name> is created.

I tried adding */~$* to the .gitignore file, but it still does not work; the temporary file still pops up in the change list shows that there are untracked changes all the time. I had to close all office files to know that my repo is up-to-date.

How to solve this problem? Is there a special syntax for .gitignore for such files?

1 Answers

To ignore any file starting with ~$, use the pattern:

~$*

Nothing more is needed.

Related