LinuxCommandLibrary

glab-alias

Create or manage GitLab command aliases

TLDR

List all the aliases glab is configured to use

$ glab alias list
copy

Create a glab subcommand alias
$ glab alias set [mrv] '[mr view]'
copy

Set a shell command as a glab subcommand
$ glab alias set [[-s|--shell]] [alias_name] [command]
copy

Delete a command shortcut
$ glab alias delete [alias_name]
copy

Display the subcommand help
$ glab alias
copy

SYNOPSIS

glab alias [list | set <name> <expansion> | rm <name>] [-h, --help]

PARAMETERS

list
    List all currently defined aliases

set <name> <expansion>
    Define a new alias where <name> expands to <expansion>, quoted if containing spaces

rm <name>
    Remove the alias named <name>

-h, --help
    Show help for alias

DESCRIPTION

The glab alias subcommand is part of the official glab CLI tool for GitLab. It enables users to create persistent shortcuts for long or frequently used glab commands, improving workflow efficiency.

Aliases are defined by mapping a short name to a full command expansion, which can include arguments and multiple words. They are stored in YAML format in the user's configuration directory, typically ~/.config/gitlab-cli/aliases.yaml, and are scoped to the active GitLab host context.

For instance, glab alias set review "mr create --draft -R group/project" allows invoking complex merge request creation with just glab review. Aliases support shell-like expansion and can be listed, set, or removed easily.

CAVEATS

Aliases are context-specific to GitLab hosts; expansions are literal and do not support advanced shell features like wildcards.

EXAMPLES

glab alias set co "issue create --weight 5"
glab co My title here # Creates weighted issue
glab alias list
glab alias rm co

SEE ALSO

glab(1)

Copied to clipboard