我有一个存储库,其中包含缩小的 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 的文件。
.gitattributes
*.gz merge=keepTheir
关于git pull 与 repo 中的 gzip 文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5443850/