Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get Branch items using VSTS Git API C#

I want to download all contents from Git Branch using VSTS Git API. I have successfully downloaded item using https://learn.microsoft.com/en-us/rest/api/vsts/git/items/get but It always pointing to master branch. I want to point to another branch.

I got the solution - by passing branch name in "versionDescriptor.version" parameter we can get the item from specific branch

like image 761
Rohi_Dev_1.0 Avatar asked Apr 05 '26 23:04

Rohi_Dev_1.0


1 Answers

The documentation states that there are optional parameters you can provide to the REST request:

versionDescriptor.version string Version string identifier (name of tag/branch, SHA1 of commit)

versionDescriptor.versionType GitVersionType Version type (branch, tag, or commit). Determines how Id is interpreted

Simply append the parameters &versionDescriptor.versionType=branch&versionDescriptor.version=[name of the branch].

like image 122
Daniel Mann Avatar answered Apr 08 '26 13:04

Daniel Mann



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!