I\'m trying to match SHA1\'s in generic text with a regular expression.
Ideally I want to avoid matching words.
It\'s safe to say that full SHA1\'s have a d
If you have access to the repo, you can use git cat-file -e to check for sure that it represents an object in the repo. This is very fast, too. If you further want to restrict this to just commits and tags, you can use git cat-file -t to find out the type of the object.
This could be used, for example, to search human-generated text for mentions of git commits and generate hyperlinks to a git web interface.