Skip to content

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).

  • The first argument after bb is looked up in your alias map. Built-in command names always win: an alias can never shadow a real bb command.
  • $1$9 placeholders 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 is a single level deep — an alias cannot reference another alias.

Create or update an alias.

Terminal window
bb alias set <name> <expansion>
Terminal window
# 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 invocation
bb alias set prd "pr create --draft"
bb prd -t "My PR" # → bb pr create --draft -t "My PR"
# JSON output
bb alias set co 'pr checkout $1' --json

An expansion starting with ! is run through sh -c 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:

Terminal window
bb alias set igrep '!bb issue list --all --json | grep "$1"'
bb igrep login # → sh -c 'bb issue list --all --json | grep "$1"' bb-alias login

List configured aliases.

Terminal window
bb alias list
Terminal window
bb alias list
bb alias list --json

Delete an alias.

Terminal window
bb alias delete <name>
Terminal window
bb alias delete co
bb alias delete co --json