1

I'm trying to get all recent branches and their first commit details. I came up with this query :

query ($owner: String!, $repo: String!, $after: String!) {
  repository(owner: $owner, name: $repo) {
    tags: refs(refPrefix: "refs/heads/", first: 100, after: $after) {
      edges {
        node {
          ...refInfo
        }
      }
      pageInfo {
        startCursor
        hasNextPage
        endCursor
      }
    }
  }
  rateLimit {
    limit
    cost
    remaining
    resetAt
  }
}

fragment refInfo on Ref {
  name
  target {
    sha: oid
    ... on Commit {
      history(first: 10) {
        pageInfo {
          hasNextPage
          endCursor
        }
        edges {
          node {
            oid
            messageHeadline
          }
        }
      }
    }
  }
}

but this would return all history commits even if they were not created in the branch. Any idea how to do that ? i believe some diff with base branch would be required but i have no idea how to do that

user2326167
  • 107
  • 1
  • 6

0 Answers0