Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

gh

Stow package for ~/.config/gh/config.yml only. The GitHub CLI’s companion file hosts.yml is deliberately not tracked — it carries OAuth tokens.

Table of contents

Layout

FileStows toTracked?
gh/.config/gh/config.yml~/.config/gh/config.ymlyes
(~/.config/gh/hosts.yml)no (gitignored)

Active customization

prefer_editor_prompt: disabled  # prompt inline in the terminal, not in $EDITOR
pager: delta                    # syntax-highlight `gh pr diff` and similar
aliases:
    co: pr checkout
    prs: pr list --author "@me"
    prv: pr view --web
    prc: pr create --fill --web
    issues: issue list --assignee "@me"
    watch: run watch
    compare: '!gh repo view --web --branch "$(git branch --show-current)"'

Alias quick-ref:

AliasExpands toUse
gh co <#>gh pr checkout <#>check out a PR locally
gh prsgh pr list --author "@me"list my open PRs in this repo
gh prvgh pr view --webopen this branch’s PR in browser
gh prcgh pr create --fill --webnew PR from commits, open in browser
gh issuesgh issue list --assignee "@me"issues assigned to me
gh watch <run-id>gh run watch <run-id>tail a GH Action run
gh compareshells out — opens the GH compare view for the current branch

The leading ! on compare is a shell-out alias; everything after runs in a subshell.

Extensions

Installed via gh extension install; they live in ~/.local/share/gh/extensions/ (not in this repo). List with gh extension list, update with gh extension upgrade --all.

ExtensionCommandUse
dlvhdr/gh-dashgh dashTUI dashboard of PRs/issues across repos with filters
seachicken/gh-poigh poiprune local branches whose PRs have been merged
kyanny/gh-pr-draftgh pr-drafttoggle the draft state of a PR

Reinstall on a fresh machine:

gh extension install dlvhdr/gh-dash
gh extension install seachicken/gh-poi
gh extension install kyanny/gh-pr-draft

Why hosts.yml stays out

~/.config/gh/hosts.yml is where gh stores per-host auth state. On machines using token auth (Linux/CI) it contains the literal token; on macOS gh typically uses Keychain but the file still holds the user identity. Either way, it’s per-machine state, not config, so:

  • gh/.config/gh/hosts.yml is listed in the repo root .gitignore.
  • The file lives at ~/.config/gh/hosts.yml as a regular file (not a symlink) and stow gh leaves it alone.

If you ever see hosts.yml show up in git status, something has gone wrong — investigate before committing.

Schema churn warning

gh rewrites config.yml when new schema fields are added in a release (it adds new commented-out entries). Expect occasional noisy diffs after brew upgrade gh. Either commit the new schema or git checkout to keep the previous version.

Fresh-machine setup

brew install gh             # in the Brewfile
stow gh
gh auth login               # populates hosts.yml (which stays untracked)