diff --git a/src/Tools/Github/GithubMergeTool/GithubMergeTool.cs b/src/Tools/Github/GithubMergeTool/GithubMergeTool.cs index 6e489790b23ee..8435fcd924ff0 100644 --- a/src/Tools/Github/GithubMergeTool/GithubMergeTool.cs +++ b/src/Tools/Github/GithubMergeTool/GithubMergeTool.cs @@ -121,6 +121,8 @@ git push {prBranchName} --force // 422 (Unprocessable Entity) indicates there were no commits to merge if (response.StatusCode == (HttpStatusCode)422) { + // Delete the pr branch if the PR was not created. + await _client.DeleteAsync($"repos/{repoOwner}/{repoName}/git/refs/heads/{prBranchName}"); return response; }