git - 如何使 git LFS 不适用于子目录

标签 git git-lfs gitattributes

我的存储库使用 git LFS 并在其 .gitattributes 中包含如下行:

*.jar filter=lfs diff=lfs merge=lfs -text

有一个 .jar 文件我想直接存储在 repo 中,不涉及 LFS。理想情况下,我会让 LFS 不适用于包含该 jar 的目录下的任何内容。有办法吗?

最佳答案

这个答案是largely sourced from this github comment

.gitattributes 的语法允许您“减去”一个属性——将其从已经包含的属性中移除(参见:https://git-scm.com/docs/gitattributes#gitattributes-Unset)

这允许您取消 lfs 之前包含的文件(来自 github 线程的示例):

*.asset filter=lfs diff=lfs merge=lfs -text
Assets/Resources/*.asset -filter=lfs -diff=lfs -merge=lfs -text

关于git - 如何使 git LFS 不适用于子目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45533593/

相关文章:

linux - 我在哪里可以找到 Gitosis 在 Linux 中管理的存储库的位置

git - 未安装 Git LFS 时会发生什么?

git - 将 SVN 转换为 Git 使用 lfs 保存大文件

git - 是否有应用 .gitattributes 的全局方法?

git - .gitattributes 使用 '* text=auto' 和过滤器

git - `.gitignore` 文件中前导斜杠的含义

git - 如何在所有分支上运行 git svn rebase

还原后 Git 在命令栏中显示 (master|REVERTING)

Git lfs 跟踪子文件夹下的所有文件

git - .gitattributes 语言学家属性标准