Context command - See what bb infers
bb context shows which workspace and repository a repository command (such
as bb pr list) would use if you ran it here, and where each value came from. It reads git and the config file
only; it never calls the Bitbucket API, so it works offline and without
credentials.
It accepts the global flags, including --json,
--jq, -w, --workspace, and -r, --repo. See
Repository Context for the resolution rules.
bb context
Section titled “bb context”bb context [options]Examples
Section titled “Examples”bb context# Workspace: my-team (git remote)# Repository: api (git remote)# Branch: feat/login
bb context --jsonbb context -w other-team -r web --jsonJSON output
Section titled “JSON output”{ "workspace": "my-team", "repo": "api", "source": { "workspace": "remote", "repo": "remote" }, "branch": "feat/login"}| Field | Description |
|---|---|
workspace |
Resolved workspace, or null |
repo |
Resolved repository slug, or null |
source.workspace |
flag (-w), remote (the git remote), env (BB_WORKSPACE), config (defaultWorkspace), or null |
source.repo |
flag (-r), remote, or null |
remote |
URL of the git remote the repository was read from, or the only remote when it is not a Bitbucket URL; any password is masked. null outside a repository |
branch |
Current branch; null outside a repository or on a detached HEAD |
-
Workspace-only commands (
bb repo list,bb repo create,bb repo clone,bb project,bb snippet,bb api) skip the git remote: they use-w, thenBB_WORKSPACE, thendefaultWorkspace. Inside a checkout they can pick a different workspace thanbb contextreports. -
A missing workspace or repository is reported as
null, not as an error, sobb contextexits 0 outside a repository. -
When
repoisnullbutremoteis set, the remote is not a URLbbrecognizes as Bitbucket. Pass-wand-rexplicitly.