1GH-ALIAS-SET(1)                GitHub CLI manual               GH-ALIAS-SET(1)
2
3
4

NAME

6       gh-alias-set - Create a shortcut for a gh command
7
8
9

SYNOPSIS

11       gh alias set <alias> <expansion> [flags]
12
13
14

DESCRIPTION

16       Define a word that will expand to a full gh command when invoked.
17
18
19       The expansion may specify additional arguments and flags. If the expan‐
20       sion includes positional placeholders such  as  "$1",  extra  arguments
21       that  follow the alias will be inserted appropriately. Otherwise, extra
22       arguments will be appended to the expanded command.
23
24
25       Use "-" as expansion argument to read the expansion string  from  stan‐
26       dard input. This is useful to avoid quoting issues when defining expan‐
27       sions.
28
29
30       If the expansion starts with "!" or if "--shell" was given, the  expan‐
31       sion  is a shell expression that will be evaluated through the "sh" in‐
32       terpreter when the alias is invoked. This allows for chaining  multiple
33       commands via piping and redirection.
34
35
36

OPTIONS

38       -s, --shell
39              Declare an alias to be passed through a shell interpreter
40
41
42

EXAMPLE

44              # note: Command Prompt on Windows requires using double quotes for arguments
45              $ gh alias set pv 'pr view'
46              $ gh pv -w 123  #=> gh pr view -w 123
47
48              $ gh alias set bugs 'issue list --label=bugs'
49              $ gh bugs
50
51              $ gh alias set homework 'issue list --assignee @me'
52              $ gh homework
53
54              $ gh alias set epicsBy 'issue list --author="$1" --label="epic"'
55              $ gh epicsBy vilmibm  #=> gh issue list --author="vilmibm" --label="epic"
56
57              $ gh alias set --shell igrep 'gh issue list --label="$1" | grep "$2"'
58              $ gh igrep epic foo  #=> gh issue list --label="epic" | grep "foo"
59
60
61
62
63

SEE ALSO

65       gh-alias(1)
66
67
68
69                                   Jun 2022                    GH-ALIAS-SET(1)
Impressum