How can I add just a single file to GIT LFS?
Most examples show adding a pattern that specifies which files to add to LFS. However, I wish to add single file. If, for example, I do
git lfs track "file.bin"
this will track all files named file.bin
regardless of what directory they are in.
I considered adding an exclusion filter (!
pattern) to .gitattributes
so exclude all directories but that is not supported.
The best I've done so far is to track the file pattern for the file I want to add, add the file and then remove the tracking of that file pattern. This is a little fiddly. Is there a better way?
I want to express the file pattern $ROOT_OF_GIT_REPO/file.bin
but am lacking a way to express the $ROOT_OF_GIT_REPO
part.
Include the path to the file, instead of just the filename.