I have a short hash that should identify a commit on my repository. I'd like to use this to get the long hash, without having to use git locally (I'm aware I can do this using 'git show 918fe27', if I have a local copy of the repo, which I don't).
Say my hash is 918fe27:
1)https://github.com/$USER/$REPO/commit/918fe27 (works, but html response)
2)https://api.github.com/repos/$USER/$REPO/git/commits/918fe2742c80b06661444857a34fcdb29c76df36 (works, but I don't have the full hash)
I'd like to use (2), but with only the short hash, but it seems that it just doesn't work that way, even though the non-api version of the same thing (1) works fine.
Does anyone know how to do this?
Give this a try https://api.github.com/repos/$USER/$REPO/commits/918fe27
Example: https://api.github.com/repos/rails/rails/commits/abe6484
Docs: http://developer.github.com/v3/repos/commits/#get-a-single-commit
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With