Anders Sundman Anders Sundman - 2 years ago 291
Git Question

Shallow Git LFS repo?

The hard drives of our local machines fill up with large files that are stored in Git LFS but that are not currently checked out.

It would be convenient if everything that is not part of the current commit was only stored at the server and downloaded as needed if a commit "exposes" them.

Is this possible using some configuration or are there any other Git extensions that could help?

Edit: A similar question suggests using

git lfs prune
. That doesn't do what I want since the files I wish removed from the local computer are not deleted. They are just not visible in the current commit.

Answer Source

You can prune all LFS files that are not part of the currently checked out commit by setting

git config lfs.pruneoffsetdays 0

once, and then running

git lfs prune

every time you want to shrink your repository. To routinely prune LFS objects, you can add the command to the pre-auto-gc hook.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download