GitHub CLI Commands
Quick reference for GitHub CLI operations.
Authentication
Section titled “Authentication”gh auth login- interactive logingh auth login --web- login via browsergh auth logout- logoutgh auth status- check statusgh auth token- print token
Repository Operations
Section titled “Repository Operations”Create & Clone
Section titled “Create & Clone”gh repo create- interactive creategh repo create <name> --public- create publicgh repo create <name> --private- create privategh repo create <name> --clone- create + clonegh repo clone <owner/repo>- clone repogh repo fork- fork currentgh repo fork --clone- fork + clone
View & List
Section titled “View & List”gh repo view- view current repogh repo view --web- open in browsergh repo list- list your reposgh repo list <owner>- list user/org repos
Issue Management
Section titled “Issue Management”Create Issues
Section titled “Create Issues”gh issue create- interactive creategh issue create --title "T"- with titlegh issue create --title "T" --body "B"- with title + bodygh issue create --label bug- with labelgh issue create --assignee @me- assign to self
List & View
Section titled “List & View”gh issue list- list opengh issue list --state closed- list closedgh issue list --state all- list allgh issue list --label bug- filter by labelgh issue list --assignee @me- assigned to megh issue view <n>- view issuegh issue view <n> --web- open in browser
Update & Close
Section titled “Update & Close”gh issue edit <n> --title "New"- update titlegh issue edit <n> --add-label bug- add labelgh issue close <n>- closegh issue reopen <n>- reopengh issue comment <n> --body "msg"- add comment
Pull Request Workflows
Section titled “Pull Request Workflows”Create PRs
Section titled “Create PRs”gh pr create- interactive creategh pr create --title "T"- with titlegh pr create --draft- as draftgh pr create --base main- set target branchgh pr create --assignee @me- assign to selfgh pr create --reviewer user- request reviewgh pr create --fill- auto-fill from commits
List & View
Section titled “List & View”gh pr list- list opengh pr list --state merged- list mergedgh pr list --state all- list allgh pr list --author @me- by megh pr view- view current branch PRgh pr view <n>- view specificgh pr view <n> --web- open in browser
Review & Checkout
Section titled “Review & Checkout”gh pr checkout <n>- checkout PR branchgh pr review --approve- approvegh pr review --request-changes- request changesgh pr review --comment- commentgh pr diff- view diff
Merge & Close
Section titled “Merge & Close”gh pr merge- merge currentgh pr merge --squash- squash + mergegh pr merge --rebase- rebase + mergegh pr merge --auto- enable auto-mergegh pr merge --delete-branch- delete branch aftergh pr close <n>- close (no merge)
Status & Checks
Section titled “Status & Checks”gh pr status- PR statusgh pr checks- view CI checksgh pr checks --watch- watch progress
Release Management
Section titled “Release Management”Create Releases
Section titled “Create Releases”gh release create <tag>- create releasegh release create v1.0.0- with version taggh release create <tag> --title "T"- with titlegh release create <tag> --notes "N"- with notesgh release create <tag> --draft- as draftgh release create <tag> --generate-notes- auto-generategh release create <tag> file.zip- upload assets
List & View
Section titled “List & View”gh release list- list releasesgh release view <tag>- view detailsgh release view --web- open in browsergh release download <tag>- download assets
Edit & Delete
Section titled “Edit & Delete”gh release edit <tag> --title "New"- update titlegh release edit <tag> --draft=false- publish draftgh release delete <tag>- delete
GitHub Actions
Section titled “GitHub Actions”Workflows
Section titled “Workflows”gh workflow list- list workflowsgh workflow view <name>- view detailsgh workflow run <name>- triggergh workflow run <name> --ref main- run on branch
gh run list- list recentgh run list --workflow <name>- filter by workflowgh run view <id>- view detailsgh run view <id> --log- view logsgh run watch <id>- watch progressgh run rerun <id>- rerungh run cancel <id>- cancel
Search
Section titled “Search”gh search repos <query>- search reposgh search repos "language:go"- by languagegh search issues <query>- search issuesgh search prs <query>- search PRsgh search code <query>- search code
Configuration
Section titled “Configuration”gh config set editor vim- set editorgh config set git_protocol ssh- set protocolgh config list- list settings
Extensions
Section titled “Extensions”gh extension list- list installedgh extension install <repo>- installgh extension upgrade <name>- upgradegh extension remove <name>- remove