So, it has been an interesting journey, but time to remove git-lfs. Here follows a summary of the approach I used to safely remove git-lfs,
git add --update; git commit -m “Commit before lfs removal”; git push
git checkout -b “remove-lfs”
- remove hooks
git lfs uninstall
- remove files enrolled in git-lfs from .gitattributes (open the file, delete the contents) [P.S. don’t delete the file!]
- list all lfs files,
git lfs ls-files
- run
git rm --cached
for each filegit lfs ls-files | cut -f 3 -d ' ' | xargs git rm --cached
- Untrack files (individually or pattern)
git lfs untrack '*.xz'
- run
git add
for each file individually - run a
git status
and make sure all the files were added properly - run
git add --renormalize .
- commit everything
git add .gitattributes
git commit -m "removed lfs"
git push
- check that no lfs files left with
git lfs ls-files
- remove any items in lfs,
rm -rf .git/lfs
Once your branch (fix/remove-lfs) is merged into develop, your team doesn't need to do anything other than simply pulling and checking out the new state of the world, their repository will work as-expected without git lfs installed. If git lfs is still installed, simply let them uninstall it: git lfs uninstall