0

Like I want to run the command(git log --since=2.days) from any remote host to github repo and get logs to the VM without the need of cloning the repo and then running the command mentioned before.

What will be the best approach to get the logs from the origin without checking out the code.

Jan Krüger
  • 17,870
  • 3
  • 59
  • 51
  • Possible duplicate of [Is it possible to get commit logs/messages of a remote git repo without git clone](https://stackoverflow.com/questions/20055398/is-it-possible-to-get-commit-logs-messages-of-a-remote-git-repo-without-git-clon) – phd Mar 20 '19 at 15:41
  • https://stackoverflow.com/search?q=%5Bgit%5D+remote+logs+without+clone – phd Mar 20 '19 at 15:41

1 Answers1

1

The Git protocol doesn't support this, but GitHub has an HTTP API to query information about repositories hosted there.

Direct link (also read the main page about the API to see how to authenticate using an API key, if you need to access information for a private repository): https://developer.github.com/v3/repos/commits/#list-commits-on-a-repository

Example:

curl -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/git/git/commits?sha=master&since=2019-03-18T11:00:00Z

Side note: GitHub also offers a GraphQL API and seems to be planning to phase out the previous APIs, but its documentation is significantly less easy to understand.

Jan Krüger
  • 17,870
  • 3
  • 59
  • 51