有没有办法强制 Git 将 .reg
文件视为文本?我正在使用 Git 来跟踪我的 Windows 注册表调整,Windows 使用 .reg
来存储这些文件。
更新 1: 我得到它来运行 diff(感谢 Andrew)。但是,现在它看起来像下面这样。这是编码问题吗?
index 0080fe3..fc51807 100644
--- a/Install On Rebuild/4. Registry Tweaks.reg
+++ b/Install On Rebuild/4. Registry Tweaks.reg
@@ -1,49 +1,48 @@
-<FF><FE>W^@i^@n^@d^@o^@w^@s^@ ^@R^@e^@g^@i^@s^@t^@r^@y^@ ^@E^@d^@i^@t^@o^@r^@
-^@;^@;^@;^@;^@;^@;^@;^@;^@;^@;^@;^@;^@;^@;^@;^@;^@;^@;^@;^@;^@;^@;^@;^@;^@;^@;
-^@^M^@
...
有什么想法吗?
更新 2: 感谢所有提供帮助的人:这是我最后所做的:创建文件 .gitattributes
内容为 *.reg text diff
然后我将文件转换为 UTF-8,因为 UTF-16 与差异很奇怪。我没有使用任何外来字符,所以 UTF-8 适合我。
最佳答案
要告诉 git 显式区分文件类型,请将以下内容放在 .gitattributes
中存储库根目录中的文件:
*.reg diff
关于windows - Git 为 *.reg 文件显示 "Binary files a... and b... differ",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5046032/