My situation
In both github and gitlab, I can compare two branches or refs in the UI:
- github:
https://github.com/*/*/compare/1.x...2.x
- gitlab:
https://*.*.*/*/*/-/compare/1.x...2.x
In github, I can append .diff
or .patch
to this comparison, to get a raw diff or patch file.
In gitlab, this does not work.
In gitlab, I can append .patch
or .diff
to a single commit url like ***/-/commit/***.diff, or to a merge request url like
***/-/merge_requests/16.patch`. But it does not work on compare urls.
Why do I need this?
I like to use these patch urls in package managers like composer, so I don t have to manually create the patch file and save it somewhere.
And sometimes I don t want to apply a single commit or a complete PR/MR, but a very specific range of commits.
Question
How can I get the raw diff or patch file for a comparison in gitlab?
Version of gitlab
The instance of gitlab I tried this with is https://git.drupalcode.org/. In the help it says the version is 15.11.7-ee.
I think I had the same experience with other gitlab instances.