Reputation: 723
I have only found git lfs ls-files
but this command give only the list from a specific ref.
There is a way to have the whole list of LFS object from a Git repository?
Upvotes: 55
Views: 60094
Reputation: 4075
You can do this in Git LFS v2.4.0 and later using the --all
flag
git lfs ls-files --all
You can read more about it in this pull request.
Upvotes: 87
Reputation: 723
I have added an issue on the GIT LFS Github: https://github.com/git-lfs/git-lfs/issues/2575
Upvotes: 2
Reputation: 3333
If you have access to the git LFS server, you can look in the lfs/objects
folder. Is should contain a folder structure that works like a search tree for the stored objects. At some level (maybe third?) are the objects themselves.
A small example with a tiny project I just converted to git (and git lfs) to test this looks like this:
$ ls lfs/objects/*/*
lfs/objects/9f/ef:
9fef0fcd855a78effd175cdf5a49a14b57334b40f1ad0c75317d6cbc0bb29595
lfs/objects/a5/f2:
a5f207bf721d3cbf62d298b6e2c9fa7cbdb3e37c7f44590a6c8be76560d7b9d7
lfs/objects/ca/63:
ca631009296d9de54dde2f70fec997aa0b22f624ed8f6fecc763c684317ba825
In my case this is inside the .git folder. I haven't pushed it to a git LFS server, but I presume the structure is the same on there. This should (as far as I can tell) give you all the hashes (as the file names) of all the files stored in git LFS.
Note: I'm basing this on experimenting with git LFS and noting what happens. Not from any deeper understanding on how the storage system behind git LFS works.
Upvotes: 3
Reputation: 22321
The "git lfs ls-files" command can't list all LFS objects for the repository the way you want. The command need to list the LFS objects for a specific reference. It's easy to understand why it can't do that if you remember that each reference represent a snapshot of the repository history. The same behaviour happens with the "git ls-files" command, you can't list all files for all repository revisions (commits) at the same time.
Upvotes: 1