PR Commands
Manage pull requests (PRs) in Bitbucket repositories. New here? Start with Create, edit, and view.
See Global flags for JSON output, workspace/repository selection, and display options.
Command groups
Section titled “Command groups”Pull request from the current branch
Section titled “Pull request from the current branch”Commands that act on one pull request take its ID as an optional [id]: view, activity, checks, edit, merge, approve, decline, ready, diff, and comments list. Leave it out and the CLI asks Bitbucket for the open pull request whose source branch is your current git branch, in the repository your checkout’s origin points at. That keeps a fork’s main from matching your main, and still works from a fork with --repo set to upstream.
git switch feature/loginbb pr view # the open PR from feature/loginbb pr checksbb pr merge --strategy squashIt only picks a pull request when exactly one matches. No match, several matches (the same branch opened against two destinations), or a detached HEAD all stop with an error asking for the ID. bb pr checkout, bb pr reviewers and the other bb pr comments subcommands still need the ID.
Most-used commands
Section titled “Most-used commands”| Task | Command |
|---|---|
| Create a PR | bb pr create -t "Add feature" |
| Create a PR with the repository’s default reviewers | bb pr create -t "Add feature" --default-reviewers |
| List open PRs | bb pr list |
| List all PRs (ignore the default limit) | bb pr list --all |
| List PRs you opened | bb pr list --author @me |
| List PRs where you are a reviewer | bb pr list --reviewer @me |
| Your PRs, review requests and current branch PR | bb pr status |
| View PR details | bb pr view 42 |
| View the PR for the current branch | bb pr view |
| View checks | bb pr checks 42 |
| Wait for checks to finish | bb pr checks 42 --watch |
| Review diff | bb pr diff 42 --stat |
| Checkout PR locally | bb pr checkout 42 |
| Approve PR | bb pr approve 42 |
| Request changes | bb pr request-changes 42 |
| Merge PR | bb pr merge 42 --strategy squash |
JSON for automation
Section titled “JSON for automation”List commands wrap their results in an envelope. Bare bb pr list --json returns {workspace, repoSlug, state, filters, count, pullRequests}, so a --jq filter starts at .pullRequests[]. Adding a field list (--json id,title) drops the envelope and returns a flat array, so the filter starts at .[] instead. Single-PR commands like bb pr view return the PR object itself, with no envelope.
# Project to specific fields (returns a flat array)bb pr list --json id,title,author.display_name
# Filter with built-in --jqbb pr list --json --jq '.pullRequests[] | select(.state == "OPEN") | .title'
# Combine projection + filter (jq runs after projection)bb pr list --json id,title,state --jq '.[] | select(.state == "OPEN") | .title'
# Grab a PR URL from view outputbb pr view 42 --json --jq '.links.html.href'
# Capture totals for the returned diffstat pagebb pr diff 42 --stat --json --jq '{filesChanged, totalAdditions, totalDeletions}'Diffstat totals can be partial; see Diff and checkout.
--json <fields> misfires on bb pr create, bb pr edit and bb pr view, see Create, Edit, and View PRs for why, and JSON Output for the full reference.