Lesstep
Bitbucket Cloud and Data Center · Pull requests · Checked November 27, 2026

Bitbucket: find the pull request for a commit

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 builds. Bitbucket Cloud and Bitbucket Data Center each answer this with one REST call, and Cloud also on the commit's page. From Atlassian's REST references, Bitbucket Cloud: Pullrequests (List pull requests that contain a commit) and Bitbucket Data Center: Repository.

Bitbucket Cloud on the web: Go to pull request

Bitbucket Cloud: the REST call

Bitbucket Data Center: the REST call

The number in the merge message

On Bitbucket Cloud, the default message of a merge commit and of a squash begins Merged in <source branch> (pull request #<number>) (our page on the default messages). So, unless someone changed the message when merging, git log --oneline --grep="(pull request #" origin/main lists those commits with their pull request numbers. To find the merge that brought a given commit into main, 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. After a squash or a fast-forward there is no such merge: use the REST call above.

Find Pull Request on Bitbucket in IntelliJ IDEA

Pull Request Inbox for Bitbucket, a plugin by Lesstep for JetBrains IDEs 2024.1 or later, lists the pull requests that wait for your review in an IDE tool window, with their diffs and discussions. From version 1.0.86, Find Pull Request on Bitbucket is on the annotate (blame) gutter and on a commit in the Git log. It asks the REST call above and opens the pull request that brought the commit in; when there are several it lists them to choose from. On Bitbucket Cloud it says in words when Bitbucket is still preparing the answer (202) or when the commit links are not on yet (404). An open one that is in your list opens in the tool window, where approving, commenting and merging are. Finding the pull request is free; creating, approving, commenting and merging are Pro, with a 30-day trial. It also works with Bitbucket Data Center (beta).

Get it on JetBrains Marketplace

Bitbucket and Atlassian are trademarks of Atlassian; IntelliJ IDEA is a trademark of JetBrains s.r.o. This page is not affiliated with or endorsed by Atlassian or JetBrains.

More: default title and merge message · Bitbucket merge strategies · revert a pull request · 日本語