| name | GitHub CLI |
| description | GitHub CLI (gh): Manage pull requests, issues, repositories, workflows, and releases from the terminal. |
| metadata | {"version":"1.0.0","maxent":{"requires":{"bins":[{"name":"gh","install":{"windows":{"method":"winget","id":"GitHub.cli"},"linux":{"method":"brew","id":"gh"},"darwin":{"method":"brew","id":"gh"}}}]}}} |
GitHub CLI (gh)
Expert guidance for GitHub CLI operations and workflows.
Installation & Setup
gh auth login
gh auth status
gh auth setup-git
Pull Requests
Creating PRs
gh pr create
gh pr create --title "Add feature" --body "Description"
gh pr create --base main --head feature-branch
gh pr create --draft
gh pr create --fill
Viewing PRs
gh pr list
gh pr list --author @me
gh pr view 123
gh pr view 123 --web
gh pr diff 123
gh pr status
Managing PRs
gh pr checkout 123
gh pr review 123 --approve
gh pr review 123 --comment --body "Looks good!"
gh pr review 123 --request-changes --body "Please fix X"
gh pr merge 123
gh pr merge 123 --squash
gh pr merge 123 --rebase
gh pr merge 123 --merge
gh pr close 123
gh pr reopen 123
gh pr ready 123
PR Checks
gh pr checks 123
gh pr checks 123 --watch
Issues
Creating Issues
gh issue create
gh issue create --title "Bug report" --body "Description"
gh issue create --title "Bug" --label bug,critical
gh issue create --title "Task" --assignee @me
Viewing Issues
gh issue list
gh issue list --assignee @me
gh issue list --label bug
gh issue view 456
gh issue view 456 --web
Managing Issues
gh issue close 456
gh issue reopen 456
gh issue edit 456 --title "New title"
gh issue edit 456 --add-label bug
gh issue edit 456 --add-assignee @user
gh issue comment 456 --body "Update"
Repository Operations
Repository Info
gh repo view
gh repo view --web
gh repo clone owner/repo
gh repo fork owner/repo
gh repo list owner
Repository Management
gh repo create my-repo --public
gh repo create my-repo --private
gh repo delete owner/repo
gh repo sync owner/repo
gh repo set-default
Workflows & Actions
Viewing Workflows
gh workflow list
gh run list
gh run view 789
gh run watch 789
gh run view 789 --log
Managing Workflows
gh workflow run workflow.yml
gh run cancel 789
gh run rerun 789
gh run download 789
Releases
Creating Releases
gh release create v1.0.0
gh release create v1.0.0 --notes "Release notes"
gh release create v1.0.0 dist/*.tar.gz
gh release create v1.0.0 --draft
gh release create v1.0.0 --generate-notes
Managing Releases
gh release list
gh release view v1.0.0
gh release download v1.0.0
gh release delete v1.0.0
Gists
gh gist create file.txt
echo "content" | gh gist create -
gh gist list
gh gist view <gist-id>
gh gist edit <gist-id>
gh gist delete <gist-id>
Advanced Features
Aliases
gh alias set pv "pr view"
gh alias set bugs "issue list --label bug"
gh alias list
gh pv 123
API Access
gh api repos/:owner/:repo/issues
gh api repos/:owner/:repo/issues -f title="Bug" -f body="Description"
gh api --paginate repos/:owner/:repo/issues
Extensions
gh extension list
gh extension install owner/gh-extension
gh extension upgrade --all
Common Workflows
Code Review Workflow
gh pr list --assignee @me
gh pr checkout 123
gh pr review 123 --approve --body "LGTM!"
gh pr merge 123 --squash
Quick PR Creation
git checkout -b feature/new-feature
git add .
git commit -m "Add new feature"
git push -u origin feature/new-feature
gh pr create --fill
gh pr view --web
Issue Triage
gh issue list
gh issue edit 456 --add-label needs-triage
gh issue edit 456 --add-label bug
gh issue edit 456 --add-assignee @developer
Configuration
gh config set editor vim
gh config set git_protocol ssh
gh config list
gh config set browser firefox
Tips
- Use
--web flag: Open items in browser for detailed view
- Interactive prompts: Most commands work interactively if you omit parameters
- Filters: Use
--author, --label, --state to filter lists
- JSON output: Add
--json flag for scriptable output
- Template repos: Use
gh repo create --template for templates
- Auto-merge: Enable with
gh pr merge --auto