I have to find out the missed commits between master and a feature branch using gitlab ui rest services. What is the curl and syntax to get these details?
You can achieve this by using the Gitlab API
GET /projects/:id/repository/compare
More info at https://docs.gitlab.com/ee/api/repositories.html#compare-branches-tags-or-commits
By executing the following
curl -s --header "PRIVATE-TOKEN: <access_token>" "https://gitlab.com/api/v4/projects/<project_id>/repository/compare?from=<branch_name_behind_in_commits>&to=<branch_name_ahead_in_commits>&straight=true" | jq '. | .commits[] | "\(.id) \(.message)"'
You will get the commit ids and their messages, that are present to master_branch
and not to feature_branch
Notes:
access_token
, you need to provide this to the command if your repo is not publicly availableproject_id
. this is the ID of the project to which you want to compare branches.from
field you should pass the branch that is behind in commits in comparison with the branch you specify in the to
field