GH-ALIAS-SET(1)

✨ GH-ALIAS-SET β€” the gh alias set glow-up ✨

okay so this is a page from the GitHub CLI manual, and honestly? it's a little life-changing. gh-alias-set = create a shortcut for a gh command. yes bestie, you can just make up your own words now πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

gh alias set <alias> <expansion> [flags]

πŸ’– DESCRIPTION πŸ’–

Define a word that will expand to a full gh command when invoked. that's it, that's the whole vibe β€” one little word, whole command behind it 🫢

The expansion may specify additional arguments and flags. If the expansion includes positional placeholders such as $1, extra arguments that follow the alias will be inserted appropriately. Otherwise, extra arguments will be appended to the expanded command. so basically $1 = "put it exactly here, queen" and no $1 = "just tack it on the end" ✨

Use - as expansion argument to read the expansion string from standard input. This is useful to avoid quoting issues when defining expansions. literally the escape hatch for when your quotes start fighting you 😭

If the expansion starts with ! or if --shell was given, the expansion is a shell expression that will be evaluated through the sh interpreter when the alias is invoked. This allows for chaining multiple commands via piping and redirection. piping and redirecting?? in my alias?? it's more likely than you think πŸ”₯


🌸 OPTIONS 🌸

  • --clobber β€” Overwrite existing aliases of the same name. no gatekeeping here, out with the old πŸ‘‘
  • -s, --shell β€” Declare an alias to be passed through a shell interpreter. this is the one that unlocks the pipes and redirects 🐚

⭐ EXIT CODES ⭐

  • 0: Successful execution πŸŽ‰
  • 1: Error 😭
  • 2: Command canceled πŸ™ˆ
  • 4: Authentication required πŸ”
NOTE: Specific commands may have additional exit codes. Refer to the command's help for more information. so like, check before you assume, iykyk πŸ’€

πŸ¦‹ EXAMPLE πŸ¦‹

# Note: Command Prompt on Windows requires using double quotes for arguments
$ gh alias set pv 'pr view'
$ gh pv -w 123  #=> gh pr view -w 123

$ gh alias set bugs 'issue list --label=bugs'
$ gh bugs

$ gh alias set homework 'issue list --assignee @me'
$ gh homework

$ gh alias set 'issue mine' 'issue list --mention @me'
$ gh issue mine

$ gh alias set epicsBy 'issue list --author="$1" --label="epic"'
$ gh epicsBy vilmibm  #=> gh issue list --author="vilmibm" --label="epic"

$ gh alias set --shell igrep 'gh issue list --label="$1" | grep "$2"'
$ gh igrep epic foo  #=> gh issue list --label="epic" | grep "foo"

the homework one is sending me 😭 like yes bestie make your responsibilities a single word. and igrep with --shell? ate. no crumbs. πŸ“


πŸ’œ SEE ALSO πŸ’œ

  • gh-alias(1) β€” the whole alias family, go say hi 🧚

made with love by the GitHub CLI girlies, version v2.102.0, dated Oct 2026 β€” go forth and alias, bestie, you're gonna slay πŸ’…βœ¨πŸŒˆ

πŸ“¦ where this page comes from