GIT: Get commits for specific path in mono repo

Viewed 611

I have a monorepo with many projects and I want to get all the commits for a specific project.

For example: I have github.com/owner/repo and under this I have directories, web, mobile and server. I want to fetch from Github API all the commits for one project. I didn't find a way to do that unfortunately...

1 Answers

I too don't know if this is possible with GitHub API, but if you clone that repo locally and use Git CLI then everything is easy:

git clone https://github.com/example/example
cd example
git log --follow --pretty=%H -- <folder>

This will list all commit SHAs where any of the files in <folder> is changed.

Related