What does the message "rewrite ... (90%)" after a Git commit mean?
GitGit Problem Overview
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
.
Thanks!
Git Solutions
Solution 1 - Git
Its a measure of the similarity index. The similarity index is the percentage of unchanged lines. git thinks your file is text.
Solution 2 - Git
I believe Martin is correct, that number is the similarity index. From the git-diff man pages:
> 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.
First time I saw the number I thought my binaries were changing dramatically!.
Solution 3 - Git
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:
*.bin -crlf -diff -merge
From this page that 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.