This thread建议放置
*.jpg binary -delta
在用于 git repo 的 .gitattribute
文件中,但我不确定它的作用。我找不到 git 的“-delta”标志的任何示例。
目的是明显加快较大文件的提交或推送时间。
最佳答案
这可能与:
包装元素
delta
Delta compression will not be attempted for blobs for paths with the attribute delta set to false.
我在“Is the git binary diff algorithm (delta storage) standardized?”中详细介绍了增量存储。
默认情况下二进制文件没有设置,因为:
our originally intended target audience are people who use git as a source code control system.
I delta jpgs in one of my repositories. It is useful if the exif metadata changes but the image data does not. I assume you could do the same with other formats which have compressed and uncompressed portions (I also do it with video containers). I don't think it would ever make sense to try to delta gzip'd or bzip'd contents.
I also don't use "
binary
", as I use a custom diff driver instead (binary implies "-diff
").As for what should be the default, until now the default has always been that no gitattributes are defined by default. This is nice because it's simple to understand; git doesn't care about filenames unless you tell it to.
The downside obviously is that it may not perform optimally for some unusual workloads without extra configuration.
The simplest way to mark a file as binary is to unset the diff attribute in the .gitattributes file:
*.ps -diff
This will cause Git to generate Binary files differ (or a binary patch, if binary patches are enabled) instead of a regular diff.
所以,是的“设置“binary
”属性也会取消设置“text
”和“diff
”属性,但是Jeff 说在他的案例中只使用了 -diff
,这足以让文件成为二进制文件。
关于git - .gitattributes 文件中的 "*.jpg binary -delta"有什么作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24978611/