diff --git a/tools/devops/automation/scripts/undo_github_merge.ps1 b/tools/devops/automation/scripts/undo_github_merge.ps1 index 32befd5053..af8e54f627 100644 --- a/tools/devops/automation/scripts/undo_github_merge.ps1 +++ b/tools/devops/automation/scripts/undo_github_merge.ps1 @@ -11,8 +11,11 @@ param if($IsPr.ToLower() -eq "true") { Write-Host "Working on a PR, Undoing the github merge with main." - git config remote.origin.fetch '+refs/pull/*:refs/remotes/origin/pull/*' - git fetch origin + $refspec="+refs/pull/$Env:SYSTEM_PULLREQUEST_PULLREQUESTNUMBER/*:refs/remotes/origin/pull/$Env:SYSTEM_PULLREQUEST_PULLREQUESTNUMBER/*" + + Write-Host "Refspec: $refspec" + + git fetch origin "$refspec" $branch="$SourceBranch".Replace("merge", "head") $branch=$branch.Replace("refs", "origin")