使用 gitlab api 比较两个提交并获得 .diff 格式的响应
Compare two commits using gitlab api and get response in `.diff` format
我想在 Gitlab 中比较两个提交并获得 .diff
格式的响应。
我尝试了 Gitlab 文档 https://docs.gitlab.com/ee/api/repositories.html#compare-branches-tags-or-commits 中列出的 API。但它只是 returns JSON
格式的差异。
如何获取 git diff 格式的数据?
这最初是在 issue 23285 五年前(2016 年 10 月)提出的:
GitHub seems have undocumented ways to download the unified diff file before create a pull request, that is: by add ".diff
" or ".patch
" suffix when comparing two branches.
But GitLab didn't have that feature yet.
在 issue 217206 中请求该特定功能。
Issue 20688 建议:
The only possible workaround, I do right now is to get the data from compare API, and then use grep to get diff, and append all of them.
我想在 Gitlab 中比较两个提交并获得 .diff
格式的响应。
我尝试了 Gitlab 文档 https://docs.gitlab.com/ee/api/repositories.html#compare-branches-tags-or-commits 中列出的 API。但它只是 returns JSON
格式的差异。
如何获取 git diff 格式的数据?
这最初是在 issue 23285 五年前(2016 年 10 月)提出的:
GitHub seems have undocumented ways to download the unified diff file before create a pull request, that is: by add "
.diff
" or ".patch
" suffix when comparing two branches.But GitLab didn't have that feature yet.
在 issue 217206 中请求该特定功能。
Issue 20688 建议:
The only possible workaround, I do right now is to get the data from compare API, and then use grep to get diff, and append all of them.