Get a list of git branches for repos hosted on github

Is there a command line way to get a list of branches available in a repo hosted on GITHUB (without creating and running commands from a clone)?

I tried using curl on a url that shows a list of branches and retrieving content.

+5
source share
2 answers
git ls-remote --heads <repo-url> 

git ls-remote user page .

For example, for git, the git git repo branches use

 $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 
+8
source

Using the GitHub API:
Send an HTTP GET request to
https://api.github.com/repos/ username / reponame /branches
The response should be an array of objects whose name attribute is the name of the branch.

A source:
https://developer.github.com/v3/repos/#list-branches

+2
source

Source: https://habr.com/ru/post/975886/


All Articles