Allan Chain
Allan Chain

Reputation: 2835

How to prevent Git from storing copies of LFS files in .git dir?

It seems that Git is storing copies of LFS files in .git/lfs. This is taking twice of the space. I know this is a typical way Git handles the files, but I'm still wondering if there is a way to prevent Git from caching copies of them and just download from cloud when trying to revert the files.

Baobab screenshot

Upvotes: 2

Views: 1013

Answers (1)

Philippe
Philippe

Reputation: 31147

If the files are in the lfs folder, it's that git needed them at a moment to populate your working directory.

So, no, there is no way to prevent git to cache them (except maybe by doing a sparse checkout if you really don't need to have the files handled by git-lfs in your working directory).

But you have an easy way to clean this cache directory (git will keep only the currently used files and delete the others unused) with the command:

git lfs prune

Upvotes: 4

Related Questions