git pull 与 repo 中的 gzip 文件?

标签 git gzip minify

我有一个存储库,其中包含缩小的 css/js 文件。其中一些是 gzip 压缩的。当我在登台和生产之间进行推送和 pull 时,它会尝试自动 merge ,但在 gz 上失败,因为它无法自动 merge 二进制文件。

有没有办法告诉 git 不要尝试 merge 某个目录,而只在发出推送请求时推送该目录的更改?

你们还有其他方法吗?

谢谢!!

更新:

我尝试将以下内容放入 .gitattributes

*.gz merge=keepTheir

每当我推送时仍然会得到这个:(请注意,其他人在我之前推送并将文件更新到该存储库中)

Auto-merging public/assets/upload.css.gz
CONFLICT (content): Merge conflict in public/assets/upload.css.gz

我做错了什么?

最佳答案

如果您需要推送内容来覆盖(而不是 merge )目标,您可以在 .gitattribute 文件中定义自定义 merge 驱动程序,以指定您想要的 *.gz 要 merge 的文件。

参见this answer as an example .

.gitattributes

*.gz merge=keepTheir

(基于“git command for making one branch like another ”)

关于git pull 与 repo 中的 gzip 文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5443850/

相关文章:

css - 将 css|js 发送到动态链接的 mod_rewrite 规则

css - minifycss 的缩小错误

r - 是否有任何服务、扩展可以缩小 R 代码?

windows - 如何在git中别名删除 merge 的分支

python - GitPython:在运行时设置 git 可执行文件

python - 尝试 git Push 时 Bitbucket 错误日志

webpack - 如何使用 Webpack 缩小 ES6 代码?

git - 推送到github时突然得到 "No supported authentication methods available"

json - gzip json 与高效二进制序列化的性能

ios - 默认情况下 Alamofire 是否请求压缩响应?