[英]Get details of a Git Commit using only the SHA-1 hash through the GitHub REST API or GraphQL API v4
[英]Get git commit from short hash using Github API
我有一個簡短的哈希,應該標識我的存儲庫中的提交。 我想用它來獲取長哈希,而不必在本地使用git(我知道我可以使用'git show 918fe27'做到這一點,如果我有本地的repo副本,我沒有)。
假設我的哈希為918fe27:
1) https://github.com/ $ USER / $ REPO / commit / 918fe27(有效,但HTML響應)
2) https://api.github.com/repos/ $ USER / $ REPO / git / commits / 918fe2742c80b06661444857a34fcdb29c76df36(有效,但我沒有完整的哈希)
我想使用(2),但僅使用短哈希,但是即使同一件事的非API版本(1)正常工作,它也似乎無法那樣工作。
有誰知道如何做到這一點?
試試看https://api.github.com/repos/$USER/$REPO/commits/918fe27
示例: https : //api.github.com/repos/rails/rails/commits/abe6484
文件: http : //developer.github.com/v3/repos/commits/#get-a-single-commit
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.