Using the Git API in a CI system (eg. GitHub Actions or Travis-CI), I want to gather information on all the branches of the repo.
Sadly, it appears that GitHub branches, unlike local branches, are isolated one from each other.
Let's say I have a repository with three branches (master
and other two created from master
):
If I run the following script:
#!/usr/bin/env bash
printf "\n$ git for-each-ref --format='%(refname)' \n"
printf "$(git for-each-ref)\n"
printf "__________________________________________\n"
printf "\n$ git branch -a\n"
printf "$(git branch -a)\n"
I can only see master
, not the other two branches:
Is there any way to read all the GitHub branches with the Git API, or I'm forced to use the GitHub API?
I hoped to be able to read at least the branches generated from the branch I'm on (master
, in this case). I'm starting to guess that GitHub keeps that information for itself, without disclosing it in any canonical Git way...