Reputation: 3746
I have the following PowerShell script to find out the latest commit in source/target branches:
$uriBranchStatus = "https://dev.azure.com/$organization/$teamProject/_apis/git/repositories/$repoName/diffs/commits?baseVersion=$branchSourcePath&targetVersion=$branchTargetPath&api-version=6.0"
$resultStatus = Invoke-RestMethod -Uri $uriBranchStatus -Method Get -ContentType "application/json" -Headers @{Authorization=("Basic {0}" -f $base64AuthInfo)}
Write-Host "Latest commit in $branchSourcePath is $($resultStatus.baseCommit)"
Write-Host "Latest commit in $branchTargetPath is $($resultStatus.targetCommit)"
Is it possible to find out the git tag associated with the latest commit in powershell script?
Upvotes: 0
Views: 45