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?
Asked
Active
Viewed 195 times
1 Answers
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).

David Butler
- 143
- 1
- 10