16

This is my listing of git lfs managed files

$ git lfs ls-files

b1d5dd29dd - file1.zip
27d3073f43 - file2.zip
fb4e699c05 * file3.zip

Why does one file have an asterisk/star (*) beside it, while the others have a dash (-) beside them?

The git lfs wiki seems to indicates that (*) is expected.

https://github.com/github/git-lfs/wiki/Tutorial

git lfs status shows all clear (nothing to be committed/pushed/staged).

3 Answers 3

13

This wasn't documented in the ls-files man page, so I dug into the source code to find the answer.

func lsFilesMarker(p *lfs.WrappedPointer) string {
    info, err := os.Stat(p.Name)
    if err == nil && info.Size() == p.Size {
        return "*"
    }

    return "-"
}

* probably means the file on disk is the same size as the one in the repository or index, depends on what's in WrappedPointer.Size. It was added in this commit, but not explained. Either way, it seems like a poor test as the content can change but not the size.

Note that the - code path is never tested. You might wish to let them know about the lack of tests and docs.

1
  • Based on the 4th line of the commit message, I would guess that the '*' indicates that the file is a LFS pointer, and a '-' indicates that the file is a full object. But again, that's just a guess.
    – cowlinator
    Commented Jul 31, 2016 at 21:31
3

This page suggests:

An asterisk (*) after the OID indicates a LFS pointer, a minus (-) a full object.

But my experience has been the opposite.

For me, the minus (-) indicated a pointer and the asterisk (*) indicated the real large-file in git lfs.

1
  • The error in the docs seems to be fixed now "An asterisk (*) after the OID indicates a full object, a minus (-) indicates an LFS pointer." Commit that fixed that: github.com/git-lfs/git-lfs/commit/…
    – 0x6d64
    Commented Aug 18, 2021 at 7:49
1

Just like in git, the '-' indicates that the file has been deleted in the working directory. The two files with '-' had indeed been inadvertently deleted. Restoring them brought back the '*'.

What threw me off was that git lfs status reported nothing, but I guess I'm interpreting it wrong.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.