In brief
git ls-files can list index entries and other file states depending on its options. It helps distinguish a tracked path from an incidental on-disk copy.
Useful to know
git ls-files can list index entries and other file states depending on its options. It helps distinguish a tracked path from an incidental on-disk copy. [1]
Choose the mode that answers the question. Directory contents and the Git index are not identical sets. Automation must also handle unusual names; splitting ordinary output on spaces is not a reliable general format.
Sources
For further detail and to check the information: