LinuxCommandLibrary

glab-alias

Create or manage GitLab command aliases

TLDR

Display the subcommand help

$ glab alias
copy

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 --shell [alias_name] [command]
copy

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

SYNOPSIS

glab alias <command> [flags]

PARAMETERS

create <alias> <command>
    Creates a new alias named <alias> for the given `glab` <command>.

list
    Lists all currently defined aliases.

delete <alias>
    Deletes the alias named <alias>.

update <alias> <command>
    Updates an existing alias with new command.

--help
    Shows help for the alias command.

--global
    Defines or uses a global alias.

DESCRIPTION

The `glab-alias` command in the GitLab CLI (glab) allows users to define and manage custom shortcuts, known as aliases, for frequently used `glab` commands. This simplifies complex operations and speeds up workflow by providing shorter, more memorable commands. Aliases can be simple replacements for existing commands or more advanced, incorporating shell commands and variable substitutions. Aliases can be created, updated, deleted, and listed. This allows users to customize the `glab` command-line interface to better suit their specific needs and preferences.

This improves efficiency, reduces typing errors, and makes the GitLab workflow more intuitive for individual users and teams. It supports local and global alias definitions, so that the same definition could apply to the local folder or globally to any glab command executed by the user.

EXAMPLES

Create an alias:
glab alias create pr 'mr list --all --source-branch'

List aliases:
glab alias list

Delete an alias:
glab alias delete pr

Create a global alias:
glab alias create --global shortcuts 'shortcuts list'

SHELL INTEGRATION

Aliases support shell command execution by prepending ! to the alias definition. Example: glab alias create --global ghq '!ghq get OWNER/REPO && cd REPO'

SEE ALSO

git(1), sh(1)

Copied to clipboard