Git 提交后的消息“rewrite ... (90%)”是什么意思?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1046276/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What does the message "rewrite ... (90%)" after a Git commit mean?
提问by dude
When git does a commit it rewrites binary files with something similar to rewrite foobar.bin (76%)
. What is that %? Is it percent changed or percent retained from the older file. I know that git uses a binary delta for files, but I just don't know how much of a rewrite the % represents and it doesn't seem to be in the help page for git help commit
.
当 git 进行提交时,它会使用类似于rewrite foobar.bin (76%)
. 那是什么 %?它是从旧文件中更改的百分比还是保留的百分比。我知道 git 对文件使用二进制增量,但我只是不知道 % 代表了多少重写,而且它似乎不在git help commit
.
Thanks!
谢谢!
采纳答案by Martin Redmond
Its a measure of the similarity index. The similarity index is the percentage of unchanged lines. git thinks your file is text.
它是相似性指数的度量。相似度指数是不变行的百分比。git 认为您的文件是文本。
回答by Daniel Gill
I believe Martin is correct, that number is the similarity index. From the git-diffman pages:
我相信马丁是正确的,这个数字是相似度指数。从git-diff手册页:
The similarity index is the percentage of unchanged lines, and the dissimilarity index is the percentage of changed lines. It is a rounded down integer, followed by a percent sign. The similarity index value of 100% is thus reserved for two equal files, while 100% dissimilarity means that no line from the old file made it into the new one.
相似指数是不变行的百分比,相异指数是变化行的百分比。它是一个向下舍入的整数,后跟一个百分号。 因此,100% 的相似性指数值保留给两个相等的文件,而 100% 的不相似性意味着旧文件中没有行进入新文件。
First time I saw the number I thought my binaries were changing dramatically!.
我第一次看到这个数字时,我以为我的二进制文件发生了巨大的变化!。
回答by Talljoe
It is attempting to rewrite CRs and LFs into a consistent format. That is, it doesn't see your binary file as binary. To force git to do this properly put the following line in .gitattributes:
它试图将 CR 和 LF 重写为一致的格式。也就是说,它不会将您的二进制文件视为二进制文件。要强制 git 正确执行此操作,请在.gitattributes中添加以下行:
*.bin -crlf -diff -merge
From this pagethat means:
从这个页面这意味着:
all files with a [.bin] extension will not have carriage return/line feed translations done, won't be diffed and merges will result in conflicts leaving the original file untouched.
所有带有 [.bin] 扩展名的文件都不会进行回车/换行转换,不会进行差异化,合并会导致冲突,而原始文件不会受到影响。