Compare two commits using gitlab api and get response in `.diff` format

Replace this template with your information

Describe your question in as much detail as possible:

  • What are you seeing, and how does it differ from what you expect to see?
    I am trying to find the Gitlab API which returns the result of comparing two commits in the diff format.

  • What version are you on (Hint: /help) ? and are you using self-managed or gitlab.com?
    I am using SaaS Gitlab

  • What troubleshooting steps have you already taken? Can you link to any docs or other resources so we know where you have been?
    I tried the APIs listed in Gitlab doc Repositories API | GitLab. But it only returns the diff in JSON format.

How can I get the data in the git diff format?

API’s always return data in JSON format, so there isn’t anything you can do about that. Most likely all you can do is manipulate the JSON data returned and pull the particular information that you want from it.

1 Like