I have 2 branches: master and test-git, test-git was created from master branch. Master branch has 3 commits, test-git is 2 commits ahead. I'm trying to get only these 2 commits by using GET /repos/{owner}/{repo}/commits?sha=test-git endpoint. But I get all 5 commits. Is there a way to get only specific 2 commits, excluding all master branch commits?
Here's the code I use:
const commits = await octokit.request('GET /repos/{owner}/{repo}/commits?sha=test-git', {
owner: 'alopwer',
repo: 'vue-countries',
headers: {
'X-GitHub-Api-Version': '2022-11-28'
}
}).then(data => data.data);
I've tried to search for similar questions, but they don't solve my issue.
I used the compare endpoint, which returns all commits the branch is ahead: https://docs.github.com/en/rest/commits/commits?apiVersion=2022-11-28#compare-two-commits