GitHub CLI GitHub from the terminal
Light · Postcard
102 × 152 mm · PDF
Dark · Postcard
102 × 152 mm · PDF
Ink saver · Postcard
102 × 152 mm · PDF
Light · A4 landscape
297 × 210 mm · PDF
Dark · A4 landscape
297 × 210 mm · PDF
Ink saver · A4 landscape
297 × 210 mm · PDF
Light · A3 landscape
420 × 297 mm · PDF
Dark · A3 landscape
420 × 297 mm · PDF
Ink saver · A3 landscape
420 × 297 mm · PDF
Start here
gh auth logingh repo clone <owner>/<repo>
gh pr create --fill
gh pr checkout <number>
gh pr merge --squash
gh issue listgh run watchgh api <endpoint>
Concepts
- Branch local commits
- Pull request review and checks
- Merged base branch
- Actions run CI and deploy
Auth and setup
gh auth logingh auth statusgh auth login --with-token < <file>
gh auth setup-git
Repositories
gh repo clone <owner>/<repo>
gh repo create <name> --public --clone
gh repo create <name> --private --source=.
--push
gh repo view --web
gh repo fork --clone
gh repo list <owner>
gh repo set-default
gh browsePull requests
gh pr create --fill
gh pr create --draft --title "<t>" --body
"<b>"
gh pr listgh pr view <number>
gh pr checkout <number>
gh pr statusgh pr diff <number>
gh pr checks --watch
gh pr review --approve
gh pr review --request-changes -b
"<text>"
gh pr comment <number> -b
"<text>"
gh pr merge --squash --delete-branch
gh pr merge --auto --squash
gh pr readygh pr edit <number> --add-label <name>
gh pr list --author @me --state all
gh pr create --reviewer <user> --label
<name>
gh pr close <number>
Issues
gh issue listgh issue create --title "<t>" --body
"<b>"
gh issue view <number>
gh issue comment <number> -b
"<text>"
gh issue close <number>
gh issue list --assignee @me
gh issue list --label <name> --state all
gh issue create --assignee @me --label <name>
gh issue develop <number> --checkout
gh issue edit <number> --add-label <name>
gh issue reopen <number>
Actions
gh run listgh run view <run-id>
gh run watchgh run view <run-id> --log-failed
gh run rerun <run-id> --failed
gh run list --branch <branch> --workflow
<name>
gh run download <run-id>
gh workflow list
gh workflow run <workflow> -f
<key>=<value>
Releases and gists
gh release listgh release create <tag> --generate-notes
gh release create <tag> <file>...
gh release download <tag>
gh gist create <file>
Search and status
gh search repos <query>
gh search issues <query>
gh search prs --author @me --state open
gh search code <query>
gh statusgh secret set <name>
API and scripting
gh api repos/{owner}/{repo}/issues
gh api <endpoint> --jq '<expr>'
gh api <endpoint> --paginate
gh api <endpoint> -f <key>=<value>
gh api <endpoint> -F <key>=<value>
gh api -X PATCH <endpoint> -f
<key>=<value>
gh api graphql -f query='<query>'
gh pr list --json number,title --jq
'.[].title'
gh pr list --json <fields> --template
'<tmpl>'
Recipes
git switch -c feature/x# commit your workgit push -u origin feature/xgh pr create --fillgh pr checks --watchgh pr merge --squash --delete-branch
gh pr checkout <number>gh pr diffgh pr review --approve -b "LGTM"
gh run list --branch <branch> --limit 5gh run view <run-id> --log-failedgh run rerun <run-id> --failed
git initgit add . && git commit -m "Initial commit"gh repo create <name> --private --source=. --push



