glab-alias
Create or manage GitLab command aliases
TLDR
List all the aliases glab is configured to use
Create a glab subcommand alias
Set a shell command as a glab subcommand
Delete a command shortcut
Display the subcommand help
SYNOPSIS
glab alias command [flags]
Commands:
glab alias list
glab alias set <alias-name> <command> [--shell]
glab alias delete <alias-name>
glab alias import
glab alias export
PARAMETERS
list
Lists all currently configured glab aliases.
set <alias-name> <command>
Creates or updates an alias named <alias-name> that executes the specified <command>. By default, <command> is interpreted as a glab command sequence.
--shell
Used with set to indicate that the <command> should be executed as a shell command, rather than a glab command. This allows aliasing complex shell scripts or other executables.
delete <alias-name>
Removes the alias specified by <alias-name> from the configuration.
import
Imports aliases from a file or standard input. This can be used to transfer alias configurations between different machines or share them.
export
Exports existing aliases to standard output or a specified file. Useful for backing up or sharing alias configurations.
DESCRIPTION
The glab-alias command, part of the glab GitLab CLI, provides functionality to manage custom command aliases. It allows users to define shorter, more memorable names for frequently used glab commands or even complex shell commands, significantly improving workflow efficiency. Aliases are stored in the user's glab configuration file (typically ~/.config/glab-cli/config.yml) and are automatically loaded by glab. This feature is essential for power users who want to customize their CLI experience and reduce repetitive typing for common GitLab operations.
CAVEATS
Aliases created with glab-alias are specific to the glab CLI and are not recognized by the system shell (e.g., bash, zsh) directly. When using the --shell flag, ensure the aliased command is valid and accessible within the shell environment where glab is executed. Aliases are stored in the user's glab configuration file, typically located at ~/.config/glab-cli/config.yml.
ALIAS STORAGE
All defined glab aliases are persisted in the glab configuration file, typically found at ~/.config/glab-cli/config.yml under the aliases section. This allows aliases to persist across shell sessions and system reboots, ensuring a consistent CLI experience.
ALIAS PRECEDENCE
When an alias is defined, it takes precedence over built-in glab commands with the same name. For example, if you create an alias named glab mr that points to glab merge request create, typing glab mr will execute your alias instead of the standard glab merge request command group.
HISTORY
glab, the GitLab CLI, was first publicly released around 2020. The alias management feature (glab-alias) was included early in its development lifecycle, recognizing the importance of user customization and efficiency for a command-line tool. It has since been a stable and integral part of the glab experience, evolving with the CLI's capabilities to offer robust alias definition and management.
SEE ALSO
glab(1), glab-config(1)