Getting commits of a branch with GraphQL but without merge request

Problem to solve

I’d like to get all the commits of a branch with GraphQL. In my project there isn’t merge request (everything is added to the develop branch (it’s a different topic how effective pattern it is but that’s the case…)) so I can’t use query like

query  {
  project(fullPath: "XXX") {
    id
    mergeRequests {
      node {
        commits(first: 100) {
          ...
        }
      }  
    }
  }
}

Is there a way to get all the commits that a branch has without using mergeRequests?

Versions

Please add an x whether options apply, and add the version information.

  • Self-managed
  • GitLab.com SaaS
  • Dedicated

Helpful resources

I checked the following stackoverflow forum question but it didn’t help:

I’d appreciate any help, thanks!