什么是“*。jpg binary -delta”在.gitattributes文件中做? [英] What does "*.jpg binary -delta" do in the .gitattributes file?
问题描述
此主题建议将
*.jpg binary -delta
存放在 .gitattribute
文件中,但我不确定它的作用。我无法找到git的'-delta'标志的任何示例。
in the .gitattribute
file for repos in git but I am not sure what it does. I cannot find any examples of the '-delta' flag for git.
目的是显然加快大文件的提交或推送时间。 b $ b
The purpose is to apparently speed up commit or push times for larger files.
推荐答案
包装对象
That could be related to:
delta
Delta属性增量设置为false的路径不会尝试增量压缩。
Delta compression will not be attempted for blobs for paths with the attribute delta set to false.
这不是由默认的二进制文件设置的,因为:
That isn't set by default of binary files because:
我们最初的目标受众是使用git作为源代码控制系统。
Jeff King adds:
我在我的一个仓库中使用delta jpgs。如果exif元数据更改但图像数据不更改则非常有用。我假设你可以对其他具有压缩和未压缩部分的格式进行相同的处理(我也使用视频容器进行处理)。我认为尝试使用delta gzip'd或bzip'd内容是没有意义的。
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.
我也不使用二进制
,因为我使用自定义比较驱动程序来代替(二元
意味着 -diff
)。
I also don't use "binary
", as I use a custom diff driver instead (binary
implies "-diff
").
至于什么应该是默认的,直到现在默认一直是默认情况下没有定义gitattributes。这很好,因为它很容易理解; git不关心文件名,除非您告诉它。
不利的一面是它可能无法以最佳方式执行某些不常见的工作负载,无需额外配置。
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 .gitattributes
man page mentions:
将文件标记为binary是在.gitattributes文件中取消设置diff属性:
The simplest way to mark a file as binary is to unset the diff attribute in the .gitattributes file:
*.ps -diff
这会导致Git产生不同的二进制文件(或二进制补丁,如果启用了二进制补丁),而不是常规差异。
This will cause Git to generate Binary files differ (or a binary patch, if binary patches are enabled) instead of a regular diff.
所以,是设置二进制
属性也会取消文本
和 diff
属性的设置,如上所述。但杰夫说他在他的情况下只使用 -diff
,这是足以让该文件成为二进制文件。
So, yes "Setting the "binary
" attribute also unsets the "text
" and "diff
" attributes as above", but Jeff was saying it was using only -diff
in his case, which was enough to lark the file as binary.
这篇关于什么是“*。jpg binary -delta”在.gitattributes文件中做?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!