I want to show the branch differences of the GitLab. So I used https://docs.gitlab.com/ee/api/repositories.html#compare-branches-tags-or-commits
I did not understand how it is comparing the branches.
GET /projects/:id/repository/compare?from=master&to=feature
in the above, what compares between master and feature?
Does this compare differences in terms of commits that are not available in master? Or shows different commits which are not available in each other?
As I observed it is showing the only differences that are not present in main.
If yes, how can I show the differences between both branches in using a single API?
Does this compare differences in terms of commits that are not available in master? or shows different commits which are not available in each other?
Your API call is missing the straight
argument:
straight
boolean: Comparison method.
true
for direct comparison between from and to (from...to
),false
to compare using merge base (from..to
).Default is
false
.
In your case, &straight=true
would show you what you want.