Showing results for 
Search instead for 
Did you mean: 
Ground Controller Lvl 1
Message 1 of 2

I'm not sure how this graphql query works

I have a graphql query that I use to grab the lastest commit on a branch, but I'm not really sure how it works. I'm confused at the part where it uses: "target", "...", and "on". I'm not really sure if this is a Github Graphql specific thing or a graphql thing as I can't find anything in the docs about it.


Can someone point me to some docs where I can find information on these?


query {
   repository(name:"hadoop-lzo", owner:"twitter"){
      ref(qualifiedName:"master") {
         target {
         ... on Commit {
            history(first: 1) {
               edges {
                  node {

1 Reply
Community Manager
Message 2 of 2

Re: I'm not sure how this graphql query works

Hey @seongju,


Thanks for being here! Looking at your query I assume you want to list the commits related to the default branch.


Inside the Commitobject, you have the history field which is used to query the list of commits related to a certain branch (i.e: `master`).


I hope that helps!

Thanks for being here, sharing, and keeping our community awesome!

Mark helpful posts with Accept as Solution to help other users locate important info. Don't forget to give Kudos for great content!