| name | github |
| description | Use when working with GitHub via CLI - pull requests, issues, code reviews, or repository operations. Also load for first-time gh CLI authentication setup. |
GitHub CLI (gh)
Use gh to interact with GitHub from the command line - pull requests, issues, and repository operations.
Quick Check
First, verify if gh is already authenticated:
gh auth status
If github.com shows "Logged in" - you're ready to go.
If not authenticated, follow the Setup Guide.
Common Commands
Pull Requests
gh pr list --repo owner/repo
gh pr view 123 --repo owner/repo
gh pr diff 123 --repo owner/repo
gh pr checkout 123 --branch pr-123-feature-name
gh pr create --title "feat: description" --base main
Issues
gh issue list --repo owner/repo --state open
gh issue view 123 --repo owner/repo
gh issue create --title "Bug: description" --body "Details..."
gh issue close 123 --repo owner/repo
Repository Info
gh repo view owner/repo
gh repo clone owner/repo
gh repo fork owner/repo
API Access
gh api repos/owner/repo/pulls/123/comments
gh api repos/owner/repo/pulls/123/reviews
PR Review Workflow
For thorough code reviews with worktrees, see PR Review Guide.
Quick version:
gh pr checkout 4 --branch pr-4-feature-name
git worktree add ../worktrees/repo/pr-4 pr-4-feature-name
Important Notes
- Token is stored in
..bosun-home/.config/gh/hosts.yml
- OAuth login works in sandbox:
gh auth login --web
- For fork PRs,
gh pr checkout fetches the fork's branch automatically
References