Do you know how to programmatically get Git commits?

Updated by Brady Stroud [SSW] 1 year ago. See history

123

Using the Azure DevOps API you can programmatically get a list of commits from your repository with only a HTTP request.

Image

Figure: HTTPS GET commits from your repository

Using HTTPS with basic authentication, make a GET request to a URL as below, substituting in your project details. A JSON object will be returned. To quickly create classes from a JSON response, see the rule Do you know how to easily get classes from a JSON response?

Image

Figure: Using the Chrome extension Postman to execute our request with Basic Authentication

For a C# implementation, see this blog post Getting Git Commits with the VSO REST API.

Acknowledgements

Drew Robson
Related rules

Need help?

SSW Consulting has over 30 years of experience developing awesome software solutions.

We open source.Loving SSW Rules? Star us on GitHub. Star