git - 我可以从 git-lfs 中排除一些文件吗?

标签 git atlassian-sourcetree git-lfs gitattributes

我用一些图像文件创建了一个仓库。我有要从 lfs 中排除的 .gitignore 和 .gitattributes。所以我需要通过 lfs 跟踪所有文件,而不是 .gitignore 和 .gitattributes。

我正在使用 Sourcetree,我在 .gitattributes 中尝试过:

.gitignore      text
.gitattributes  text
*               filter=lfs diff=lfs merge=lfs -text

但是我的所有文件都被 lfs 跟踪。

最佳答案

.gitattributes.gitignore 类似在优先级方面。

*               filter=lfs diff=lfs merge=lfs -text
.gitignore      filter= diff= merge= text
.gitattributes  filter= diff= merge= text

这将取消设置这些文件的过滤器、差异、 merge ,并且 lfs 不会跟踪它们。

关于git - 我可以从 git-lfs 中排除一些文件吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57595420/

相关文章:

Git:我可以将我的工作目录提交到一个新分支而不将它提交到当前分支吗?

git - 设置 SourceTree 将 unity3d 场景与 UnityYAMLMerge merge

git - 如何设置 "unsafe"Git LFS 配置项?

git - Bash:如何捕获 git 命令失败?

git - Redmine - Git 推送失败 [远程拒绝] 钩子(Hook)被拒绝

atlassian-sourcetree - 如何在源树中链接外部差异工具(超越比较)?

python - 将 Dash 应用部署到 Heroku : error code=H10, H13

git-lfs - 修复 git-lfs 用户错误

git - 在 git rebase 期间自动选择要编辑的 sha

git - 我需要 git 子模块吗?