Confused by user info, timestamps, and urls in Commit objects #24391
-
Dear GitHub Support Community, As I continue to learn the GitHub GraphQL API, I have used the following sample query with the gql library for Python:
And here is the API response: Click to expand API response
I am confused about the seemingly subtle differences between some of the fields, specifically:
Sorry for all the questions, hope someone can help elucidate these details! Thank you! 😁 |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
penyuan:
GitHub uses the metadata created by Git in a commit to present the respective author and committer information for a commit. When using Git on the command line, it’s possible to specify an author of the commit who is not the committer themselves. This practice was common before pull requests and Git-hosting providers existed, where a contributor would submit a patch file to the mailing list and a committer would review the patch before committing it to the repository on behalf of the author. Drawing from the Git SCM -
penyuan:
Extending from the earlier explanation, it’s possible for an author to write the changes at a different time than when they’re committed.
penyuan:
Looking at the
The
penyuan:
We can inspect that particular commit by making a request to either of these endpoints: I made the following calls and extracted the respective
In cases like these, it’s possible that this commit was created through the GitHub web flow (like editing a file and committing the changes, or pressing the merge button to merge the changes proposed in a pull request). Building from that context, this guide explains why commits may not be linked to any user. Does that help explain things? |
Beta Was this translation helpful? Give feedback.
-
francisfuzz:
Ah I didn’t know that. Great to know that there’s flexibility in how to provide attribution and credit in Git.
OK.
It’s a bit counterintuitive to me, since I’d think in this case the user would be attributed to as the
Yes, thank you! 🙏t5: |
Beta Was this translation helpful? Give feedback.
GitHub uses the metadata created by Git in a commit to present the respective author and committer information for a commit.
When using Git on the command line, it’s possible to specify an author of the commit who is not the committer themselves. This practice was common before pull requests and Git-hosting providers existed, where a contributo…