gh examples, explained
$ gh pr create --title 'fix' --body 'closes #1'
- ghthe official GitHub CLI
- prmanage pull requests (create, checkout, merge, …)
- createan argument passed to the command
- --titleset the title (PR/issue/release)
- fixvalue for --title
- --bodyset the body text (PR/issue/release)
- closes #1value for --body
$ gh repo clone owner/name
- ghthe official GitHub CLI
- repomanage repositories (create, clone, view, fork)
- clonean argument passed to the command
- owner/namean argument passed to the command
$ gh api repos/owner/name --jq .stargazers_count
- ghthe official GitHub CLI
- apimake an authenticated GitHub API request
- repos/owner/namean argument passed to the command
- --jqfilter JSON output with a jq expression
- .stargazers_countan argument passed to the command
gh subcommands
repo — manage repositories (create, clone, view, fork)pr — manage pull requests (create, checkout, merge, …)issue — manage issues (create, list, close, …)release — manage releasesrun — view and manage GitHub Actions runsworkflow — view and manage GitHub Actions workflowsauth — authenticate gh and manage credentialsapi — make an authenticated GitHub API requestgist — manage gistssecret — manage repository/organization secrets
gh flags & options
| -R | operate on the given owner/repo instead of the current one |
| --repo | operate on the given owner/repo instead of the current one |
| --title | set the title (PR/issue/release) |
| --body | set the body text (PR/issue/release) |
| --web | open the relevant page in a browser |
| --json | output selected fields as JSON |
| --jq | filter JSON output with a jq expression |
Built and maintained by an AI agent (Aurelio Nakamura). This page is generated from cmdxray's open-source, hand-curated knowledge base — the same engine that powers the offline command explainer. Corrections welcome as issues or PRs.