Manage pull requests in Bitbucket repositories.
bb pr create
Create a new pull request.
Options
| Option | Description |
|---|
-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-branch | Close source branch after merge |
--json | Output as JSON |
Examples
# 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.
bb pr edit [id] [options]
Arguments
| Argument | Description |
|---|
id | Pull request ID (optional - auto-detects from current branch) |
Options
| Option | Description |
|---|
-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 |
--json | Output as JSON |
Examples
bb pr edit 42 -t "Updated: Add new feature"
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
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.
Options
| Option | Description |
|---|
-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
# List open PRs in current repository
# List PRs in specific repository
bb pr list -w myworkspace -r myrepo
# List with JSON output for scripting
bb pr view
View pull request details.
bb pr view <id> [options]
Arguments
| Argument | Description |
|---|
id | Pull request ID |
Options
| Option | Description |
|---|
-w, --workspace <workspace> | Workspace |
-r, --repo <repo> | Repository |
--json | Output as JSON |
Examples
# View PR #42 in current repository
# View PR in specific repository
bb pr view 42 -w myworkspace -r myrepo
bb pr merge
Merge a pull request.
bb pr merge <id> [options]
Arguments
| Argument | Description |
|---|
id | Pull request ID |
Options
| Option | Description |
|---|
-w, --workspace <workspace> | Workspace |
-r, --repo <repo> | Repository |
-m, --message <message> | Merge commit message |
--close-source-branch | Delete source branch after merge |
--strategy <strategy> | Merge strategy: merge_commit, squash, fast_forward |
--json | Output as JSON |
Examples
# 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.
bb pr approve <id> [options]
Arguments
| Argument | Description |
|---|
id | Pull request ID |
Options
| Option | Description |
|---|
-w, --workspace <workspace> | Workspace |
-r, --repo <repo> | Repository |
--json | Output as JSON |
Examples
# Approve PR in current repository
# Approve PR in specific repository
bb pr approve 42 -w myworkspace -r myrepo
bb pr decline
Decline a pull request.
bb pr decline <id> [options]
Arguments
| Argument | Description |
|---|
id | Pull request ID |
Options
| Option | Description |
|---|
-w, --workspace <workspace> | Workspace |
-r, --repo <repo> | Repository |
--json | Output as JSON |
Examples
# Decline PR in current repository
# 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.
bb pr checkout <id> [options]
Arguments
| Argument | Description |
|---|
id | Pull request ID |
Options
| Option | Description |
|---|
-w, --workspace <workspace> | Workspace |
-r, --repo <repo> | Repository |
--json | Output as JSON |
Examples
# Checkout PR #42 to review locally
# Checkout PR from specific repository
bb pr checkout 42 -w myworkspace -r myrepo
Notes
The command will:
- Fetch the latest changes from the remote
- Try to checkout the PR’s source branch
- 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.
bb pr diff [id] [options]
Arguments
| Argument | Description |
|---|
id | Pull request ID (optional - auto-detects from current branch) |
Options
| Option | Description |
|---|
-w, --workspace <workspace> | Workspace |
-r, --repo <repo> | Repository |
--color <when> | Colorize output: auto, always, never (default: auto) |
--name-only | Show only names of changed files |
--stat | Show diffstat (files changed, insertions, deletions) |
--web | Open diff in web browser |
--json | Output as JSON |
Examples
# Auto-detect PR from current branch
# Show only changed file names
bb pr diff 42 --name-only
# Show statistics (like git diff --stat)
# 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)