GitHub REST API : git tag --contains

标签 github github-api

我正在尝试识别包含特定提交的所有标签。使用 git 命令工具,可以通过以下方式完成:

git tag --contains <commit>

但是,我需要为多个存储库执行此操作,因此我期望依赖 REST API。有没有办法通过 GitHub 的 REST API 收集相同的信息?

最佳答案

我找到了 this answer在一个相关的问题上给我我需要的东西。

你先get a list of tags对于您的 repo :

https://api.github.com/repos/:user/:repo/tags

然后,对于每个标签,您将 compare the branch with the SHA :
https://api.github.com/repos/:user/:repo/compare/:tagName...:sha_of_commit

如果status的值响应中的属性是 divergedahead ,则提交不包含在标记中。如果status的值属性是 behindidentical ,则提交包含在标记中。

关于GitHub REST API : git tag --contains,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36184945/

相关文章:

java - 如何使用 maven/travis 将二进制文件打包、压缩并部署为 zip/tar.gz 从 github 存储库到 bintray.com 通用存储库

Github Wiki - 源代码语法高亮

git - 删除引用问题的已删除提交

git - 我如何在git中切换分支?

git - 如何放弃本地更改并从 GitHub 存储库中提取最新版本

python - 用户帐户的 Github API 调用

redmine - 通过 API 将文件附加到 GitHub 中的问题

python-3.x - Github API 生成的带注释的标签未显示在 git describe 中

javascript - GitHub API使用ajax上传图片

maven - 如何检索导入特定 Maven 依赖项的 GitHub Java 项目?