Alias Commands
Create your own shortcuts for bb commands, mirroring gh alias. An alias
expands in place of the first argument: after bb alias set co 'pr checkout $1',
running bb co 42 runs bb pr checkout 42.
Aliases are stored in the aliases map of the configuration file
and are managed with the commands below (not with bb config set).
How expansion works
Section titled “How expansion works”- The first argument after
bbis looked up in your alias map. Built-in command names always win: an alias can never shadow a realbbcommand. $1–$9placeholders in the expansion are filled from the arguments that follow the alias. Missing arguments are an error.- Arguments not consumed by a placeholder are appended to the expanded command.
- Expansion runs once. An alias cannot reference another alias.
bb alias set
Section titled “bb alias set”Create or update an alias.
bb alias set <name> <expansion>Examples
Section titled “Examples”# Shortcut with a placeholder (single quotes keep $1 literal for bb)bb alias set co 'pr checkout $1'bb co 42 # → bb pr checkout 42
# Shortcut for a flag-heavy invocationbb alias set prd "pr create --draft"bb prd -t "My PR" # → bb pr create --draft -t "My PR"
# JSON outputbb alias set co 'pr checkout $1' --jsonShell passthrough (! prefix)
Section titled “Shell passthrough (! prefix)”An expansion starting with ! is run through sh -c (PowerShell on Windows
without sh, see below) instead of being parsed as a bb command. The
arguments after the alias are available as shell positional parameters ($1,
$@), so pipes, xargs, and other shell constructs work:
bb alias set igrep '!bb pipeline list --all --json | grep "$1"'bb igrep deploy # → sh -c 'bb pipeline list --all --json | grep "$1"' bb-alias deployOn Windows
Section titled “On Windows”Windows usually has no sh on PATH (Git for Windows only adds it inside Git
Bash). When sh isn’t found, bb runs the body as a PowerShell script block
instead, with pwsh if it’s installed and Windows PowerShell otherwise. The
arguments arrive in $args ($args[0] is the first), and the alias exits
non-zero when its last command fails, with a native command’s own exit code.
Write the body in PowerShell syntax:
bb alias set igrep '!bb pipeline list --all --json | Select-String $args[0]'bb igrep deployWhere sh is on PATH (Git Bash, MSYS2, Cygwin, WSL) the alias still runs
through sh -c, so existing POSIX aliases keep working there. The choice
follows PATH, not the terminal you typed in, so the same alias can run in
sh from Git Bash and in PowerShell from a PowerShell window. Write the body
for the shell you run bb from.
bb alias list
Section titled “bb alias list”List configured aliases.
bb alias listExamples
Section titled “Examples”bb alias listbb alias list --jsonbb alias delete
Section titled “bb alias delete”Delete an alias.
bb alias delete <name>Examples
Section titled “Examples”bb alias delete cobb alias delete co --json