I created a repo with some image files. I have .gitignore and .gitattributes that I want to exclude from lfs. So I need to track all files by lfs but not .gitignore and .gitattributes.
I' m using Sourcetree and I tried that in .gitattributes:
.gitignore text
.gitattributes text
* filter=lfs diff=lfs merge=lfs -text
But all of my files getting tracked by lfs.
Use your favorite text editor to open the file called . git/info/exclude within the root of your Git repository. Any rule you add here will not be checked in, and will only ignore files for your local repository.
DESCRIPTION. Deletes local copies of LFS files which are old, thus freeing up disk space.
.gitattributes
works similarly to .gitignore
in terms of precedence.
* filter=lfs diff=lfs merge=lfs -text
.gitignore filter= diff= merge= text
.gitattributes filter= diff= merge= text
This will unset the filter, diff, merge for those files, and lfs won't track them.
I was looking for the same. I am using git
version 2.26.2 and rkedge's answer did not work for me. I found this thread and ended up using:
*.dat filter=lfs diff=lfs merge=lfs -text
excluded.dat !filter !diff !merge text
For files already commited, I had to untrack and re-commit them after modifying .gitattributes
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With