【问题标题】:Does Github GraphQL return commit parents in a particular order?Github GraphQL 是否以特定顺序返回提交父级?
【发布时间】:2022-01-15 18:01:54
【问题描述】:

根据文档 (https://docs.github.com/en/graphql/reference/objects#commit),parents 函数返回“提交的父母”。这些排序方式与 git 中的方式相同吗?例如,如果我将分支 B 合并到分支 A,合并提交的第一个父级是否来自分支 A?

【问题讨论】:

    标签: git github graphql github-graphql


    【解决方案1】:

    是的,但您可以按自己喜欢的方式订购。即您上面提到的顺序,或使用 firstlast 参数的相反顺序。您可以在GitHub's GraphQL Explorer使用以下查询

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

    当然要输入有效的 repo 名称和所有者以及提交哈希 (oid)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-09-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-13
      • 1970-01-01
      • 2010-09-15
      相关资源
      最近更新 更多