Git说“二进制文件a ...和b ...不同”打开* .reg文件 [英] Git says "Binary files a... and b... differ" on for *.reg files

查看:219
本文介绍了Git说“二进制文件a ...和b ...不同”打开* .reg文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法强制Git将 .reg 文件作为文本处理?我使用Git来跟踪我的Windows注册表调整,而Windows使用 .reg 来处理这些文件。



更新1:我得到它运行差异(谢谢,安德鲁)。但是,现在看起来如下所示。这是一个编码问题?

 索引0080fe3..fc51807 100644 
--- a /安装重建/ 4 。注册表Tweaks.reg
+++ b /在重建时安装/ 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对diffs很奇怪。我没有使用任何外来字符,所以UTF-8适用于我。 为了告诉git显式地区分文件类型,将以下内容放在 .gitattributes
$ p $ *。reg diff
code>


Is there a way to force Git in to treating .reg files as text? I am using Git to track my windows registry tweaks and Windows uses .reg for these files.

UPDATE 1: I got it to run a diff (thanks, Andrew). However, now it looks like this below. Is this an encoding issue?

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^@
...

Any ideas?

UPDATE 2: Thanks all who helped: here's what I did in the end: create file .gitattributes with content *.reg text diff and then I converted the files to UTF-8 as UTF-16 is weird with diffs. I'm not using any foreign characters so UTF-8 works for me.

解决方案

To tell git to explicitly diff a filetype, put the following in a .gitattributes file in your repository’s root directory:

*.reg diff

这篇关于Git说“二进制文件a ...和b ...不同”打开* .reg文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆