使用GitHub API获得简短的哈希值

时间:2018-10-20 09:29:25

标签: github-api

我想获取GitHub提交的短哈希值/ sha,有没有办法使用GitHub API获取短哈希值? 我无法在官方文档页面上找到任何内容。

1 个答案:

答案 0 :(得分:0)

这个技巧对我有用:

curl -s -L https://api.github.com/repos/:ORG/:REPO/git/refs/heads/master | grep sha | cut -d '"' -f 4 | cut -c 1-7