GitHub CLI#
gh is GitHub’s official command-line surface. It puts issues,
pull requests, releases, gists, and repository administration next
to the operator’s git tree, so the work doesn’t bounce between
the terminal and the web UI. Authentication is via gh auth
login (browser flow or token); the token lives in the system
keyring on supported platforms.
Authenticate#
$ gh auth login # browser or token
$ gh auth status # confirm host + scopes
$ gh auth refresh -s repo,read:org # add scopes after the fact
Pull requests#
The PR is the single most operator-relevant surface. gh pr
inspects, checks out, comments on, and merges PRs without a
browser.
$ gh pr list # open PRs in the current repo
$ gh pr status # PRs you're involved in
$ gh pr view <num> # in-terminal preview
$ gh pr view <num> --web # open in browser
$ gh pr checkout <num> # fetch + check out as a local branch
$ gh pr diff <num> # diff without checkout
$ gh pr create --fill # auto-fill title / body from commits
$ gh pr create --title "T" --body "B" # explicit
$ gh pr review <num> --approve # review actions: --approve / --comment / --request-changes
$ gh pr merge <num> --squash --delete-branch
Issues#
$ gh issue list # open issues
$ gh issue list --state closed --assignee @me
$ gh issue view <num>
$ gh issue create --title "T" --body "B"
$ gh issue close <num> --reason completed
Repos#
$ gh repo clone owner/name # clone over the authenticated host
$ gh repo fork owner/name --clone # fork and clone in one shot
$ gh repo view --web # open the current repo in browser
$ gh release list # release tags
$ gh release create v1.0.0 --notes "..."
References#
Git for the underlying source-control surface.
GitHub Exploit for the offensive view of GitHub estates.