Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

check if git branch is locked using api on azure devops

Is there a way to check which branch's are locked by rest api or tf.exe or any client library api?

I try work follow this article https://learn.microsoft.com/en-us/rest/api/azure/devops/git/refs/list?view=azure-devops-rest-5.0#gitref and the response not contains the locked/unlocked flag.

Thanks.

like image 350
David Gershtenkoren Avatar asked Dec 02 '25 10:12

David Gershtenkoren


1 Answers

https://{baseUrl}/{organisation}/{project}/_apis/git/repositories/{repoId}/refs?filter=heads/***/master&api-version=6.0
  • Replace the placeholders with correct details of your repos and give your branch name(heads/***/master) of which you want check it is locked or not.

enter image description here

  • One catch over here, if your branch is not locked then "Islocked" & "Creator" section will not ever get in response.

  • To get for all the branches info you can run url without filters eg. https://{baseUrl}/{organisation}/{project}/_apis/git/repositories/{repoId}/refs?&api-version=6.0

like image 156
Anand Kishore Avatar answered Dec 04 '25 06:12

Anand Kishore



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!