Search code examples
gitgithubgit-lfsgit-lfs-migrate

Git LFS: Where are the files stored before they are pushed?


I added git LFS to a repository and wanted to convert a few already committed files to LFS objects. I ran the following command: git lfs migrate import --include="*.shelf"

Now in my local repository, all *.shelf files have been replaced with text pointers.

I then ran a git push, but unfortunately, the sizes of my files were too big even for LFS, and the command caused an error. Now all I have is text pointers and do not know how to get my original files back.

Surely they must be saved somewhere locally before they were pushed?

How do I get my original files back?


Solution

  • How do I get my original files back?

    Check first if git lfs-checkout would work.

    Try to ensure that the working copy contains file content for Git LFS objects for the current ref, if the object data is available.
    Does not download any content, see git-lfs-fetch for that.

    As documented in "What does git lfs migrate do?":

    the original git-objects of the binary files are still in the .git folder

    The content of the file is stored in the .git/lfs/objects folder