Gitlab中的分支差异

Branch difference in Gitlab

我想展示 GitLab 的分支差异。所以我用了https://docs.gitlab.com/ee/api/repositories.html#compare-branches-tags-or-commits

我不明白它是如何比较分支的。

GET /projects/:id/repository/compare?from=master&to=feature 上面master和feature有什么区别?

这是否比较了 master 中不可用的提交方面的差异? 或者显示彼此不可用的不同提交?

据我观察,它显示了主要内容中不存在的唯一差异。

如果是,我如何显示两个分支在使用单个 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?

您的 API 调用缺少 straight 参数:

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.

在你的情况下,&straight=true 会告诉你你想要什么。