There is no built in thing to find this. phd's comment will get you close, possibly close enough, but may over-fit a bit (although one might still like to know about these things).
For instance, suppose some commit has files:
path/TO/file1.ext
path/to/file2.ext
On your file system, only either path/TO
or path/to
may exist. Once one of those exists, these two files will be dropped into the same path/$to
folder, where $to
is either lowercase or uppercase. They will still be separate files, but will be called out by case-folding and sort-and-unique-dash-c-ing.
On macOS, we can also have collisions in paths due to Unicode normalization. Linux considers a file named 's' 'c' 'h' 'combining-umlaut' 'o' 'n'
to be one file name, and a file named 's' 'c' 'h' 'o-with-umlaut' 'n'
to be a second, different file name. The macOS default file systems will turn both names into a common form and claim that this is just one name. (I have no idea what Windows does with this.) A proper tool will should take this into account as well.
Note that Git will store each file separately in the index, and can update each separate index entry from a file-system-stored-file independent of the stored-file's path name. So we could have Git build a mapping from internal name to external name and make it handle these cases all automatically. But that's a pretty big task.
git ls-files | tr '[A-Z]' '[a-z]' | sort | uniq -c
— list files in the index, convert filenames to lowercase, sort, count non-unique paths. – Undervalue