GitHub :包含特定提交的标签
GitHub : Tags that include a specific commit
在 Github 上,当您访问与提交对应的页面时 - like this - 您可以看到以下内容:
我想在分支 (master
) 旁边,页面显示了包含该特定提交的存储库标签(在本例中:4.8.0, 4.7.1, 4.7.0, 4.6.2, 4.6.1
和 4.6.0
)。
有没有办法通过 GitHub REST API 或通过 GIT 命令行工具访问该信息?
我不确定 REST API,但您可以从 Git 的 CLI
git tag --contains <commit>
这将输出从此提交可访问的所有标签。 <commit>
可以是提交或对象...即分支名称、标记名称或 sha。
Is there a way to access that information through GitHub REST API, or through GIT command line tools?
您可以通过多种方式获取所有标签的列表。
GitHub API
Get a Tag
GET /repos/:owner/:repo/git/tags/:sha
回复:
{
"tag": "v0.0.1",
"sha": "940bd336248efae0f9ee5bc7b2d5c985887b16ac",
"url": "https://api.github.com/repos/octocat/Hello-World/git/tags/940bd336248efae0f9ee5bc7b2d5c985887b16ac",
"message": "initial version\n",
"tagger": {
"name": "Scott Chacon",
"email": "schacon@gmail.com",
"date": "2014-11-07T22:01:45Z"
},
"object": {
"type": "commit",
"sha": "c3d0be41ecbe669545ee3e94d31ed9a4bc91ee3c",
"url": "https://api.github.com/repos/octocat/Hello-World/git/commits/c3d0be41ecbe669545ee3e94d31ed9a4bc91ee3c"
}
}
git log
git log --decorate --graph --oneline
git tag
git tag --contains <commit>
--contains [<commit>]
Only list tags which contain the specified commit (HEAD if not specified).
在 Github 上,当您访问与提交对应的页面时 - like this - 您可以看到以下内容:
我想在分支 (master
) 旁边,页面显示了包含该特定提交的存储库标签(在本例中:4.8.0, 4.7.1, 4.7.0, 4.6.2, 4.6.1
和 4.6.0
)。
有没有办法通过 GitHub REST API 或通过 GIT 命令行工具访问该信息?
我不确定 REST API,但您可以从 Git 的 CLI
git tag --contains <commit>
这将输出从此提交可访问的所有标签。 <commit>
可以是提交或对象...即分支名称、标记名称或 sha。
Is there a way to access that information through GitHub REST API, or through GIT command line tools?
您可以通过多种方式获取所有标签的列表。
GitHub API
Get a Tag
GET /repos/:owner/:repo/git/tags/:sha
回复:
{
"tag": "v0.0.1",
"sha": "940bd336248efae0f9ee5bc7b2d5c985887b16ac",
"url": "https://api.github.com/repos/octocat/Hello-World/git/tags/940bd336248efae0f9ee5bc7b2d5c985887b16ac",
"message": "initial version\n",
"tagger": {
"name": "Scott Chacon",
"email": "schacon@gmail.com",
"date": "2014-11-07T22:01:45Z"
},
"object": {
"type": "commit",
"sha": "c3d0be41ecbe669545ee3e94d31ed9a4bc91ee3c",
"url": "https://api.github.com/repos/octocat/Hello-World/git/commits/c3d0be41ecbe669545ee3e94d31ed9a4bc91ee3c"
}
}
git log
git log --decorate --graph --oneline
git tag
git tag --contains <commit>
--contains [<commit>]
Only list tags which contain the specified commit (HEAD if not specified).