如何禁用 Git 的 MSWord 与“*.dot”文件的集成?

How to disable Git's MSWord integration with `*.dot` files?

我创建了一个扩展名为 *.dot 的文件。 这是一个文本文件,与MS Word无关。

当我尝试使用 git diff 时出现此错误:

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.

显然 Git 认为它是一个 Word 文档。 我很惊讶 -- 我认为 Git 将所有文件都视为文本。

我可以配置 Git 将其视为普通文本文件吗?

问题出在我的机器上 (运行 Windows 10):当文件在 GitHub 上时,我可以正确地看到它的差异。

我的 C:\Program Files\Git\etc\gitattributes 文件包含如下条目:

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

astextplainC:\Program Files\Git\usr\bin\ 中的脚本,它调用 C:\Program Files\Git\mingw64\bin\antiword.exe.

astextplain 也对 Open Document、PDF 和 RTF 文件执行类似的操作。

所以一个解决方案似乎是一个名为 .gitattributes 的文件(例如在包含 *.dot 文件的项目或目录中),其内容如下:

*.dot   diff=
*.DOT   diff=