Home > front end >  How to disable Git's MSWord integration with `*.dot` files?
How to disable Git's MSWord integration with `*.dot` files?

Time:03-09

I made a file with a *.dot extension. It's a text file, nothing to do with MS Word.

When I try to use git diff I get this error:

C:\Users\Christopher\Source\Repos\time>git diff dependencies/dependencies.dot
warning: CRLF will be replaced by LF in dependencies/dependencies.dot.
The file will have its original line endings in your working directory
C:\Users\CHRIST~1\AppData\Local\Temp/fX3Ut1_dependencies.dot is not a Word Document.
dependencies/dependencies.dot is not a Word Document.

Apparently Git thinks it's a Word Document. I'm surprised -- I thought Git treated all files as text.

Can I configure Git to treat this like a regular text file?

The problem is on my machine (running Windows 10): when the file is on GitHub I can properly see its diffs.

CodePudding user response:

My C:\Program Files\Git\etc\gitattributes file contains an entry like this:

*.dot   diff=astextplain
*.DOT   diff=astextplain

astextplain is a script in C:\Program Files\Git\usr\bin\ which invokes C:\Program Files\Git\mingw64\bin\antiword.exe.

astextplain also does something similar for Open Document, PDF, and RTF files.

So a solution seems to be a file named .gitattributes (e.g. in the project or directory which contains the *.dot file) with content as follows:

*.dot   diff=
*.DOT   diff=
  • Related