是否可以比较Bitbucket 服务器中的两次提交?
对于位桶式云,您可以在浏览器中输入如下网址:https://bitbucket.org/OWNER/PROJECT/branches/compare/commit2..commit1
(此讨论中:https://bitbucket.org/site/master/issues/4779/ability-to-diff-between-any-two-commits)。
同一件事(以及许多其他功能)在Bitbucket服务器中似乎不起作用,因为我收到404错误。
答案 0 :(得分:1)
Bitbucket服务器不支持https://bitbucket.org/OWNER/PROJECT/branches/compare/commit2..commit1
。
您可以使用REST API来区分任意提交。 Here是该REST API端点的文档。
diff的命令行是:“ git diff A B”,其中显示了从A到B的更改。RESTURL看起来像
/rest/api/latest/projects/KEY/repos/slug/changes?since=A&until=B
(其中A和B具有相同的相关性)。这将列出所有已更改的文件。
您可以调用/ rest / api / latest / projects / KEY / repos / slug / diff /?since = A&until = B。在“ / diff /”之后和“?since”之前写入您要比较的文件路径。
示例:
https://mybitbucket.com/rest/api/latest/projects/STASH/repos/stash/changes?since=689fcf1017dc944ab976433a9ead8f2912d83622&until=a222a1f58c17f9164eb498eeaadde94675a49467}}
https://mybitbucket.com/rest/api/latest/projects/STASH/repos/stash/diff/dao-impl/src/main/java/com/atlassian/stash/internal/pull/HibernateRescopeRequestDao.java?since=689fcf1017dc944ab976433a9ead8f2912d83622&until=a222a1f58c17f9164eb498eeaadde94675a49467
您将必须在{{/ diff}}之后添加路径。您不能只要求整个差异。