获取github上托管的repo的git分支列表

Sen*_*mar 6 git github github-api

是否有一种命令行方式来获取GITHUB中托管的repo中可用的分支列表(无需在克隆中创建和运行命令)?

我尝试在显示分支列表和获取内容的URL上使用curl.

Cha*_*esB 10

git ls-remote --heads <repo-url>
Run Code Online (Sandbox Code Playgroud)

手册页git ls-remote.

例如,要git git的git repo使用的分支

$git ls-remote --heads git://github.com/git/git.git      
121f71f0da1bc9a4e1e96be2c3e683191a82a354    refs/heads/maint
f623ca1cae600e97cb0b38131fdd33e4fb669cf8    refs/heads/master
8e148144574e6c6511b591286e44a677a260d760    refs/heads/next
fcdb578342aeaf355c296026af08093b20aab9b4    refs/heads/pu
5321cb29c8f709669c5e4a04f502cd984623592c    refs/heads/todo
Run Code Online (Sandbox Code Playgroud)


wiz*_*zz4 5

使用GitHub API:

https://api.github.com/repos/用户名/reponame 发送GET HTTP请求/branches
回复应为对象数组,其name属性为分支名称。

来源:https :
//developer.github.com/v3/repos/#list-branches