How to get commit list of files in repository using githubapi

Asked 1 years ago, Updated 1 years ago, 245 views

I would like to use the GitHub API to get commit information for files in the repository.

If you specify the following, you will get commit information for the entire repository.

requests.get(f"https://api.github.com/repos/ {OWNER}/{REPO}/commits")

For example, if there is a way to retrieve the commit list in the specified files in the repository as follows, please let me know.

https://api.github.com/repos/ {OWNER}/{REPO}/{FILE}/commits

github webapi

2023-02-05 06:59

1 Answers

The English version had almost the same questions and answers.

Is it possible to get commits history for one file ingithub api?- Stack Overflow

You can specify it in the following format:

http://api.github.com/repos/:owner/:repo/commits?path=PATH_TO_FILE

Example:
https://api.github.com/repos/izuzak/pmrpc/commits?path=README.markdown

The detailed documentation is as follows:

http://developer.github.com/v3/repos/commits/ #list-commits-on-a-repository


2023-02-05 07:33

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.