Search code examples
gitgitattributesgit-ls-files

git ls-files - undocumented syntax that queries files based on their .gitattributes - git ls-files ':(attr:filter=lfs)'


Is comparing git lfs ls-files with git ls-files ':(attr:filter=lfs)' a reliable way to detect lfs files that are not managed by lfs? uses git ls-files syntax that queries files based on their .gitattributes (in that particular case on filter=lfs)

git ls-files ':(attr:filter=lfs)'

The problem is that though it actually works without issues, it is not something that is explained in documentation - https://git-scm.com/docs/git-ls-files

So, is it something that I miss in docs, or is it some undocumented feature?


Solution

  • It's documented at gitglossary:

    After attr: comes a space separated list of "attribute requirements", all of which must be met in order for the path to be considered a match; this is in addition to the usual non-magic pathspec pattern matching.