There are a lot of articles in the web saying it is a good practice to place binary files under LFS. So, .gitattributes
file will look like this:
## Fonts
*.otf filter=lfs diff=lfs merge=lfs -text
*.OTF filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.TTF filter=lfs diff=lfs merge=lfs -text
Note that all the entries contain -text
which tells git to not treat these files as text files and treat them as binary.
Now, let's say I want to track some text files with extension *.yaml
as LFS because they are very large but still text based. Should I create entries in the same way as for binary ones or should I omit -text
like this?
*.yaml filter=lfs diff=lfs merge=lfs
*.YAML filter=lfs diff=lfs merge=lfs
Yes, you always want to exclude the text
attribute for files using Git LFS. The reason is that you don't want the pointer files stored in the repository to be subject to line-ending conversions or encoding changes, since that would make them invalid, nor do you want that for the large files, since that makes the hash change and therefore the underlying pointer file change as well. The text
attribute controls these aspects, and therefore it should be disabled.