Files are still (not) in GIT LFS after changing .gitattributes

Viewed 1071

When using GIT LFS, .gitattributes controls which files are managed by GIT LFS and which ones are not. According to the documentation, all it takes to move files between GIT LFS and regular GIT storage is to change .gitattributes.

I have modified .gitattributes in a Bitbucket repository, but git lfs ls-files still lists the same files as before, including files that should no longer be managed by GIT LFS and not including files that should now be managed by GIT LFS. Also, committing and pushing the change in .gitattributes is suspiciously fast.

Is there a command that I can (or have to) run to update the GIT LFS status of all files and move them to the correct storage?

1 Answers

Well, it seems that git lfs have to be used like git lfs track something.bin, and manually change .gitattributes won't really add exist files to LFS.

If you manually modify the .gitattributes file, my solution is:

After modify the file, run these commands:

git rm --cached -r .
git add -A

It may take a while if there is a lot of files. But it does the trick.

Related