How can I get last commit from GitHub API

前端 未结 2 1131
春和景丽
春和景丽 2020-12-31 04:35

Which is the best way to get the latest commit information from a git repository using GitHub API (Rest API v3).

Option 1: GET /repos/:owner/:repo/commits/mast

2条回答
  •  感动是毒
    2020-12-31 05:27

    It depends on your definition of "last".

    • for a given branch (like master), GET /repos/:owner/:repo/commits/master is indeed the last (most recent) commit.

    • But you can also consider the last push event: that would represent the last and most recent commit done (on any branch), pushed by a user to this repo.

提交回复
热议问题