Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make git LFS not apply to a subdirectory

My repository uses git LFS and includes lines such as this one in its .gitattributes:

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

There's one .jar file that I want to store in the repo directly, not involving LFS. Ideally, I would make LFS not apply to anything under the directory that contains that jar. Is there a way to do that?

like image 487
Christopher Simmons Avatar asked Aug 06 '17 15:08

Christopher Simmons


People also ask

How do you stop LFS?

If you wish to delete the LFS file in your repository, navigate to the Repository settings > Git LFS and click the "..." drop-down on the right side of the files, then click Delete files. I hope this helps.

What is LFS locking?

File Locking lets developers lock files they are updating to prevent other users from updating them at the same time. Concurrent edits in Git repositories will lead to merge conflicts, which are very difficult to resolve in large binary files.


1 Answers

This answer is largely sourced from this github comment

The syntax for .gitattributes allows you to "minus" an attribute -- removing it from already being included (see: https://git-scm.com/docs/gitattributes#gitattributes-Unset)

This allows you un-lfs a file that was previously included (the example from the github thread):

*.asset filter=lfs diff=lfs merge=lfs -text
Assets/Resources/*.asset -filter=lfs -diff=lfs -merge=lfs -text
like image 56
Anthony Sottile Avatar answered Sep 23 '22 03:09

Anthony Sottile