git - Git 不会将 .html 文件视为二进制文件,即使它在 .gitattributes 中标记为二进制文件
问题描述
我试图让 git 将编译后的代码标记为二进制文件,以便清理差异。在大多数情况下,这是有效的,但不适用于.html
文件。
这是我的.gitattributes
web/themes/custom/*/css/** -diff
web/themes/custom/*/dist/** -diff
web/themes/custom/*/pattern-lab/** -diff
web/themes/custom/*/pattern-lab/**/*.html -diff
web/themes/custom/columbia_sps/pattern-lab/public/patterns/00-base-global-01-colors-colors/00-base-global-01-colors-colors.html -diff
正如你所看到的,最后两行是我试图让它与更具体的东西一起工作。
这是一个差异
$ git show b118f56069f96cd9f1c60ca9d8eca1a213aeabc1
diff --git a/web/themes/custom/columbia_sps/dist/style.css b/web/themes/custom/columbia_sps/dist/style.css
index 2af390be7..9e0570210 100644
Binary files a/web/themes/custom/columbia_sps/dist/style.css and b/web/themes/custom/columbia_sps/dist/style.css differ
diff --git a/web/themes/custom/columbia_sps/dist/style.css.map b/web/themes/custom/columbia_sps/dist/style.css.map
index c558df481..1a6ac917c 100644
Binary files a/web/themes/custom/columbia_sps/dist/style.css.map and b/web/themes/custom/columbia_sps/dist/style.css.map differ
diff --git a/web/themes/custom/columbia_sps/pattern-lab/public/latest-change.txt b/web/themes/custom/columbia_sps/pattern-lab/public/latest-change.txt
index b8064ad75..cdea372dd 100644
Binary files a/web/themes/custom/columbia_sps/pattern-lab/public/latest-change.txt and b/web/themes/custom/columbia_sps/pattern-lab/public/latest-change.txt differ
diff --git a/web/themes/custom/columbia_sps/pattern-lab/public/patterns/00-base-global-01-colors-colors/00-base-global-01-colors-colors.html b/web/themes/custom/columbia_sps/pattern-lab/public/patterns/00-base-global-01-colors-colors/00-base-global-01-colors-colors.html
index 733999083..a9e9ba436 100644
--- a/web/themes/custom/columbia_sps/pattern-lab/public/patterns/00-base-global-01-colors-colors/00-base-global-01-colors-colors.html
+++ b/web/themes/custom/columbia_sps/pattern-lab/public/patterns/00-base-global-01-colors-colors/00-base-global-01-colors-colors.html
@@ -45,10 +45,10 @@
<link rel="stylesheet" href="/libraries/select2/dist/css/select2.min.css" media="all" />
<!-- Pattern Lab base styles. -->
- <link rel="stylesheet" href="../../../../dist/styleguide-specific.css?cacheBuster=1553203845">
+ <link rel="stylesheet" href="../../../../dist/styleguide-specific.css?cacheBuster=1553539945">
<!-- Component styles -->
- <link rel="stylesheet" href="../../../../dist/style.css?1553203845" media="all" />
+ <link rel="stylesheet" href="../../../../dist/style.css?1553539945" media="all" />
<!-- Drupal-specific usage -->
<!-- example using symlinking -->
<snip>
所以它似乎适用于除.html 之外的所有文件类型,即使我在 .html 中明确列出了该文件.gitattributes
。
为什么?
解决方案
根据评论,问题是.gitattributes
文件系统中有一个文件覆盖了顶级.gitattributes
文件。
推荐阅读
- python - 如何在一行中编写嵌套的 if-elif-else 条件?
- git - Git - 从提交到主文件中永久排除文件(删除)
- symfony - 如何在我的项目 symfony 4 中卸载包 lexik / jwt-authentication-bundle
- reactjs - 如何在 React + Typescript 中为延迟加载创建 hoc
- bash - bash 星号转义在 echo 中打印 \*
- c# - .NET Core Fakes 和 VS 2019 Preview 6.9.0 Preview 2.0 找不到类型或命名空间名称
- docker - Docker 将文件从主机复制到映像
- swift - SecKeyCreateSignature 在哪里获取钥匙串签名授权对话框的密钥名称?
- python - 乌龟显示错误,以前可以正常工作
- java - 当我按下“新项目”时,如何在 Intellij Idea 的开始菜单中配置技术列表