2
votes

I want to download all contents from Git Branch using VSTS Git API. I have successfully downloaded item using https://docs.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

1

1 Answers

2
votes

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].