Lesstep
Azure DevOps · Pull requests · Checked November 27, 2026

Azure DevOps: find the pull request that brought a commit in

You have a commit ID, or a line in blame that looks wrong, and you want the pull request it came through: the discussion, who approved it, the linked work items. Azure DevOps answers this with one REST call, Pull Request Query. Below are the call, which of its two query types you need, a git command for when the API is not at hand, and the same thing in IntelliJ IDEA. From Microsoft's REST reference, Pull Request Query - Get, and Complete a pull request.

The REST call: Pull Request Query

commit or lastMergeCommit

Without the API: git

When pull requests are completed with a merge commit, you can find the merge on the target branch that brought a commit in, then ask Pull Request Query with lastMergeCommit and that merge's ID. In Bash (Git Bash on Windows), replace <commit>:

for m in $(git rev-list --first-parent --merges --reverse origin/main); do
  git merge-base --is-ancestor <commit> $m && { git log -1 --oneline $m; break; }
done

It walks the merges of origin/main from the oldest and prints the first one that contains the commit. The shorter git log --merges --ancestry-path <commit>..origin/main can stop at the wrong merge when main was merged into the branch after the commit; with --first-parent added it can print nothing for the same reason. After a squash merge the commit is not on main at all, so this finds nothing: use the commit query above with the original commit ID.

Find Pull Request on Azure DevOps in IntelliJ IDEA

Azure DevOps Pull Requests, a plugin by Lesstep for JetBrains IDEs 2024.1 or later and Android Studio, lists the pull requests of Azure DevOps Services and Azure DevOps Server in an IDE tool window. From version 1.0.104, Find Pull Request on Azure DevOps is on the annotate (blame) gutter and on a commit in the Git log. It sends both queries above and opens the pull request that brought the commit in; when there are several it lists them to choose from, completed ones first, and when there is none it says so. An active one that is in your list opens in the tool window, where voting, commenting and completing are. Finding the pull request is free; voting, commenting, completing and creating pull requests are Pro, with a 30-day trial.

The plugin named Find Pull Request on JetBrains Marketplace, by another developer, lists GitHub, GitLab and Bitbucket as the services it supports; Azure DevOps is not among them.

Get it on JetBrains Marketplace

Azure DevOps is a trademark of Microsoft Corporation; IntelliJ IDEA is a trademark of JetBrains s.r.o. This page is not affiliated with or endorsed by Microsoft or JetBrains.

More: merge types · revert and cherry-pick · work items linked to a pull request · 日本語