Gitlab api to get commits in a merge request

gitlab, gitlab-ci

Solution

I think you are looking for this:

curl --header "PRIVATE-TOKEN: ****" "http://gitlab/api/v3/projects/:project_id:/merge_requests/:mr_id:/commits"

https://docs.gitlab.com/ce/api/merge_requests.html#get-single-mr-commits

Problem

From the GITLAB API documentation, I can get the merge request details, from which I can get the source project and the branch. The api to get the list of commits in the branch, list all the commits in that branch. Is there a way to get the list of commits specific to a merge request through API.? The objective is to know only the new commits in the merge request. Thank You.

Original source