What defines the the ideal length of a short commit hash?
CI/CD providers surprisingly often hard-code the idea that a "short commit hash is 7-digit long"; I am working with a repository, where a 7-long hash is often ambiguous.
git rev-parse --short HEAD
(without explicitly provided "how short") returns a short hash which I can then use everywhere and does remain unique within the repositry.
How does git do that?
Based on the answer to that, I hope I could decude the answers for my more use-case specific questions I have:
- Can I determine this optimal length without checking out the code? [edit: as in through some APIs of providers such as github/gitlab/bitbucket/...]
- Can even git calculate this given a shallow checkout?