Skip to content

GraphQL - list all branches by repository #24416

Discussion options

You must be logged in to vote

This query should give you the information that you’re asking for:

{
  search(query: "org:udayabaski", type: REPOSITORY, last: 100) {
    nodes {
      ... on Repository {
        nameWithOwner
        refs(first: 100, refPrefix: "refs/heads/") {
          nodes {
            name
            target {
              ... on Commit {
                oid
                committedDate
              }
            }
          }
        }
      }
    }
  }
}

The thing to know is that branches are a type of ref (short for reference), something that refers to another object in the git database.

I hope that helps!

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants