How to fetch commits from repos?


any possibility to grab these data ?

what is this “ref” ? how to use it to get git tree, branch and commits


A “ref” (short for reference) is anything that points to a git commit. This could be a local branch, a tag, a remote branch, etc. So master, for example, would be considered a ref. In that vein, you can use the ref field on the Repository type to get a reference that targets a commit. From that commit, you can get all of the commit’s parents. If you target master, you can get the main history of the git repository. For example:

query {
  node(id: "MDEwOlJlcG9zaXRvcnk4NDM5MTQ3") {
    ... on Repository {
      ref(qualifiedName: "master") {
        target {
          ... on Commit {
            history(first: 30) {
              pageInfo {

              edges {
                node {
                  author {

That query would get the master ref and the commit it targets. From that commit, you’d get the most recent 30 commits in the master branch’s history, as well as author information for each commit and whether or not you’ll need to page through more.

Commit on repository

thanks @davidcelis

after search branches in github graphiql docs, there’s no info at all, is that a unsupported feature for now ?


How can we use graphql to fetch details about a certain commit in a given branch with giving the commit hash?