Search code examples
gitgithublarge-filesgit-lfs

How to replace large files with links in git lfs


I have a repo setup with Git LFS (Large File Storage) and I pulled the large files into my local branch without putting any exclude statements in, so all the large files have been downloaded on my local.

This takes up a lot of space, and I don't need all of the files on my local, so I would like to convert the actual large files into links so they take up less space. This is what would have happened if I had used exclude statements before I pulled the updated repo.

I've looked around and haven't found any explicit instructions, and I have learned I am not competent enough in git to just play around in the git repo, so any help is appreciated.


Solution

  • $ git lfs pointer --file="filename"
    

    This will print the pointer to the stdout. You could copy the contents to new file and delete the downloaded LFS file.

    more detailed steps:

    https://sabicalija.github.io/git-lfs-intro/