GitHub CLI
gh wraps GitHub APIs for PRs, issues, Actions, and releases from the terminal - the fastest path from cargo test green to review requested.
Search across all documentation pages
gh wraps GitHub APIs for PRs, issues, Actions, and releases from the terminal - the fastest path from cargo test green to review requested.
gh auth login
gh pr create --fill --web
gh pr checks
gh run watchWhen to reach for this:
git pushworkflow_dispatch releasesgit push -u origin feat/api-42-health
gh pr create \
--title "feat(api): health route [API-42]" \
--body "Adds /health and /ready for k8s probes." \
--reviewer teammate
gh pr checkout 128
cargo test
gh pr comment 128 --body "cargo test green locally on 1.97.0"
gh run list --workflow ci.yml --limit 3
gh run view <id> --log-failedWhat this demonstrates:
--fill uses commit messages for PR title/bodypr checkout integrates with local gitrun view --log-failed shows clippy/test failures quicklygh alias set co 'pr checkout'
gh alias set rv 'pr view --web'gh release create v1.2.0 \
target/release/my-cli-x86_64-unknown-linux-gnu \
--notes-file CHANGELOG.mdgh targets origin URL. Fix: gh repo set-default.gh auth refresh -s workflow.--log-failed filter.GH_HOST or gh auth login --hostname.| Alternative | Use When | Don't Use When |
|---|---|---|
| GitHub web UI | Complex PR templates | Daily create/watch loop |
hub (legacy) | Old scripts | New setups - use gh |
| Graphite / stacked CLI | Stacked PRs workflow | Simple single PR |
git manages objects and refs; gh manages GitHub platform features.
Maintainers use gh workflow run or approve pull_request_target per security policy.
gh preinstalled; gh cs manages codespaces when enabled.
Stack versions: This page was written for Rust 1.97.0 (edition 2024), Tokio 1.x, Axum 0.8, serde 1.0, sqlx 0.8, clap 4, and Polars 0.46+.
Reviewed by Chris St. John·Last updated Jul 16, 2026