7

I am working on a project where I need to know when exactly a commit was pushed to a remote repository on Github. Using the git APIs and commands I can only find the commit's 'authored_date' and 'committed_date', which represent the time of the commit at the local repository.

I tried the approaches presented in this question: Is there a way in git to obtain a push date for a given commit?. They only work when a commit was pushed from the same local machine, while I need them for commits in a cloned projects.

Thank you.

Taher A. Ghaleb
  • 5,120
  • 5
  • 31
  • 44
  • Possible duplicate of [Is there a way in git to obtain a push date for a given commit?](https://stackoverflow.com/questions/6795070/is-there-a-way-in-git-to-obtain-a-push-date-for-a-given-commit) – orhtej2 Jan 09 '18 at 20:02
  • 3
    In that question, the answers do not describe a way of getting a push date for a specific commit. Second, they only show the pushes done from the machined being used. Please, reconsider my question as I see that it is not a duplicate of that one. Thanks. – Taher A. Ghaleb Jan 10 '18 at 21:22

1 Answers1

0

Try to play with List Repository Events

For example: https://api.github.com/repos/JetBrains/kotlin/events

It returns all the events for the repository. Look there for the event with type="PushEvent" containing your commit SHA in the payload/comits/sha

This approach has some limitations:

  • you can not request filtered events by type, you are only able to fetch them all and filter them on your side
  • Only events created within the past 90 days will be included in timelines (according to GitHub doc)
  • you have to care about pagination if you have massive events on your project
Denys Kurochkin
  • 1,360
  • 1
  • 18
  • 34