1

According to the documentation (https://docs.github.com/en/graphql/reference/objects#commit), the parents function returns "the parents of a commit." Are these sorted the same way as in git? For example, if I merge branch B into branch A, will the first parent of the merge commit be from branch A?

1 Answer 1

1

Yes, but you can order in whatever way you like. i.e. the order you mention above, or the reverse order by using the first and last arguments. You can use the following query over at GitHub's GraphQL Explorer

{
  repository(owner: {owner}, name: {name}) {
    object(oid: {oid}) {
      ... on Commit {
        parents(first: 10) {
          nodes {
            oid
            message
          }
        }
      }
    }
  }
}

Of course entering valid repo name and owner and commit hash (oid).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.