Skip to content

PR Commands

Manage pull requests in Bitbucket repositories.

bb pr create

Create a new pull request.

Terminal window
bb pr create [options]

Options

OptionDescription
-t, --title <title>Pull request title (required)
-b, --body <body>Pull request description
-s, --source <branch>Source branch (default: current branch)
-d, --destination <branch>Destination branch (default: main)
-w, --workspace <workspace>Workspace
-r, --repo <repo>Repository
--close-source-branchClose source branch after merge
--jsonOutput as JSON

Examples

Terminal window
# Create a PR from current branch to main
bb pr create -t "Add new feature"
# Create a PR with full details
bb pr create -t "Add login page" -b "Implements user login functionality" -d develop
# Create a PR that will close the source branch after merging
bb pr create -t "Hotfix: Critical bug" --close-source-branch

bb pr edit

Edit an existing pull request’s title or description.

Terminal window
bb pr edit [id] [options]

Arguments

ArgumentDescription
idPull request ID (optional - auto-detects from current branch)

Options

OptionDescription
-t, --title <title>New pull request title
-b, --body <body>New pull request description
-F, --body-file <file>Read description from file
-w, --workspace <workspace>Workspace
-r, --repo <repo>Repository
--jsonOutput as JSON

Examples

Terminal window
# Edit PR title by ID
bb pr edit 42 -t "Updated: Add new feature"
# Edit PR description
bb pr edit 42 -b "This PR implements the new login flow"
# Edit both title and description
bb pr edit 42 -t "New title" -b "New description"
# Auto-detect PR from current branch and update title
bb pr edit -t "Updated title"
# Read description from a file
bb pr edit 42 -F description.md
# Get updated PR as JSON
bb pr edit 42 -t "New title" --json

Notes

  • When no ID is provided, the command searches for an open PR where the source branch matches your current git branch
  • At least one of --title, --body, or --body-file must be provided
  • The --body-file option reads the entire file contents as the new description

bb pr list

List pull requests.

Terminal window
bb pr list [options]

Options

OptionDescription
-w, --workspace <workspace>Workspace
-r, --repo <repo>Repository
-s, --state <state>Filter by state: OPEN, MERGED, DECLINED, SUPERSEDED (default: OPEN)
--limit <number>Maximum number of PRs (default: 25)

Examples

Terminal window
# List open PRs in current repository
bb pr list
# List merged PRs
bb pr list -s MERGED
# List declined PRs
bb pr list -s DECLINED
# List PRs in specific repository
bb pr list -w myworkspace -r myrepo
# List with JSON output for scripting
bb pr list --json
# List more results
bb pr list --limit 50

bb pr view

View pull request details.

Terminal window
bb pr view <id> [options]

Arguments

ArgumentDescription
idPull request ID

Options

OptionDescription
-w, --workspace <workspace>Workspace
-r, --repo <repo>Repository
--jsonOutput as JSON

Examples

Terminal window
# View PR #42 in current repository
bb pr view 42
# View PR in specific repository
bb pr view 42 -w myworkspace -r myrepo
# Get PR details as JSON
bb pr view 42 --json

bb pr merge

Merge a pull request.

Terminal window
bb pr merge <id> [options]

Arguments

ArgumentDescription
idPull request ID

Options

OptionDescription
-w, --workspace <workspace>Workspace
-r, --repo <repo>Repository
-m, --message <message>Merge commit message
--close-source-branchDelete source branch after merge
--strategy <strategy>Merge strategy: merge_commit, squash, fast_forward
--jsonOutput as JSON

Examples

Terminal window
# Merge PR #42
bb pr merge 42
# Merge with squash strategy and delete source branch
bb pr merge 42 --strategy squash --close-source-branch
# Merge with custom commit message
bb pr merge 42 -m "Merge feature: Add user authentication"

bb pr approve

Approve a pull request.

Terminal window
bb pr approve <id> [options]

Arguments

ArgumentDescription
idPull request ID

Options

OptionDescription
-w, --workspace <workspace>Workspace
-r, --repo <repo>Repository
--jsonOutput as JSON

Examples

Terminal window
# Approve PR in current repository
bb pr approve 42
# Approve PR in specific repository
bb pr approve 42 -w myworkspace -r myrepo

bb pr decline

Decline a pull request.

Terminal window
bb pr decline <id> [options]

Arguments

ArgumentDescription
idPull request ID

Options

OptionDescription
-w, --workspace <workspace>Workspace
-r, --repo <repo>Repository
--jsonOutput as JSON

Examples

Terminal window
# Decline PR in current repository
bb pr decline 42
# Decline PR in specific repository
bb pr decline 42 -w myworkspace -r myrepo

bb pr checkout

Checkout a pull request locally. This command fetches the PR’s source branch and checks it out, creating a local tracking branch if needed.

Terminal window
bb pr checkout <id> [options]

Arguments

ArgumentDescription
idPull request ID

Options

OptionDescription
-w, --workspace <workspace>Workspace
-r, --repo <repo>Repository
--jsonOutput as JSON

Examples

Terminal window
# Checkout PR #42 to review locally
bb pr checkout 42
# Checkout PR from specific repository
bb pr checkout 42 -w myworkspace -r myrepo

Notes

The command will:

  1. Fetch the latest changes from the remote
  2. Try to checkout the PR’s source branch
  3. If the branch doesn’t exist locally, create a new branch named pr-<id> tracking origin/<source-branch>

bb pr diff

View the diff of a pull request. Shows the changes introduced by the PR in unified diff format with syntax highlighting.

Terminal window
bb pr diff [id] [options]

Arguments

ArgumentDescription
idPull request ID (optional - auto-detects from current branch)

Options

OptionDescription
-w, --workspace <workspace>Workspace
-r, --repo <repo>Repository
--color <when>Colorize output: auto, always, never (default: auto)
--name-onlyShow only names of changed files
--statShow diffstat (files changed, insertions, deletions)
--webOpen diff in web browser
--jsonOutput as JSON

Examples

Terminal window
# View diff for PR #42
bb pr diff 42
# Auto-detect PR from current branch
bb pr diff
# Show only changed file names
bb pr diff 42 --name-only
# Show statistics (like git diff --stat)
bb pr diff 42 --stat
# Open diff in browser
bb pr diff 42 --web
# Disable colors for piping to file or other commands
bb pr diff 42 --color never > pr-42.patch
# Get diffstat as JSON for scripting
bb pr diff 42 --stat --json

Notes

  • When no ID is provided, the command searches for an open PR where the source branch matches your current git branch
  • The --stat output shows files changed with insertions (+) and deletions (-)
  • Use --color never when piping output to files or other commands
  • The diff is colorized by default when output is a terminal (green for additions, red for deletions, cyan for hunk headers)