1GH-ALIAS-SET(1) GitHub CLI manual GH-ALIAS-SET(1)
2
3
4
6 gh-alias-set - Create a shortcut for a gh command
7
8
9
11 gh alias set <alias> <expansion> [flags]
12
13
14
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
38 --clobber
39 Overwrite existing aliases of the same name
40
41
42 -s, --shell
43 Declare an alias to be passed through a shell interpreter
44
45
46
48 # note: Command Prompt on Windows requires using double quotes for arguments
49 $ gh alias set pv 'pr view'
50 $ gh pv -w 123 #=> gh pr view -w 123
51
52 $ gh alias set bugs 'issue list --label=bugs'
53 $ gh bugs
54
55 $ gh alias set homework 'issue list --assignee @me'
56 $ gh homework
57
58 $ gh alias set 'issue mine' 'issue list --mention @me'
59 $ gh issue mine
60
61 $ gh alias set epicsBy 'issue list --author="$1" --label="epic"'
62 $ gh epicsBy vilmibm #=> gh issue list --author="vilmibm" --label="epic"
63
64 $ gh alias set --shell igrep 'gh issue list --label="$1" | grep "$2"'
65 $ gh igrep epic foo #=> gh issue list --label="epic" | grep "foo"
66
67
68
69
70
72 gh-alias(1)
73
74
75
76 Oct 2023 GH-ALIAS-SET(1)