gh reference
A comprehensive reference of all gh commands
Synopsis
gh reference
gh alias <command>
Create command shortcuts
gh alias delete <alias>
Delete an alias
gh alias list
List your aliases
gh alias set <alias> <expansion> [flags]
Create a shortcut for a gh command
-s, --shell Declare an alias to be passed through a shell interpreter
gh api <endpoint> [flags]
Make an authenticated GitHub API request
-F, --field stringArray Add a parameter of inferred type
-H, --header stringArray Add an additional HTTP request header
--hostname string The GitHub hostname for the request (default "github.com")
-i, --include Include HTTP response headers in the output
--input string The file to use as body for the HTTP request
-X, --method string The HTTP method for the request (default "GET")
--paginate Make additional HTTP requests to fetch all pages of results
-f, --raw-field stringArray Add a string parameter
--silent Do not print the response body
gh auth <command>
Login, logout, and refresh your authentication
gh auth login [flags]
Authenticate with a GitHub host
-h, --hostname string The hostname of the GitHub instance to authenticate with
-s, --scopes strings Additional authentication scopes for gh to have
-w, --web Open a browser to authenticate
--with-token Read token from standard input
gh auth logout [flags]
Log out of a GitHub host
-h, --hostname string The hostname of the GitHub instance to log out of
gh auth refresh [flags]
Refresh stored authentication credentials
-h, --hostname string The GitHub host to use for authentication
-s, --scopes strings Additional authentication scopes for gh to have
gh auth status [flags]
View authentication status
-h, --hostname string Check a specific hostname's auth status
-t, --show-token Display the auth token
gh completion -s <shell>
Generate shell completion scripts
-s, --shell string Shell type: {bash|zsh|fish|powershell}
gh config <command>
Manage configuration for gh
gh config get <key> [flags]
Print the value of a given configuration key
-h, --host string Get per-host setting
gh config set <key> <value> [flags]
Update configuration with a value for the given key
-h, --host string Set per-host setting
gh gist <command>
Manage gists
gh gist clone <gist> [<directory>] [-- <gitflags>...]
Clone a gist locally
gh gist create [<filename>... | -] [flags]
Create a new gist
-d, --desc string A description for this gist
-f, --filename string Provide a filename to be used when reading from STDIN
-p, --public List the gist publicly (default: private)
-w, --web Open the web browser with created gist
gh gist delete {<gist ID> | <gist URL>}
Delete a gist
gh gist edit {<gist ID> | <gist URL>} [flags]
Edit one of your gists
-f, --filename string a specific file to edit
gh gist list [flags]
List your gists
-L, --limit int Maximum number of gists to fetch (default 10)
--public Show only public gists
--secret Show only secret gists
gh gist view {<gist id> | <gist url>} [flags]
View a gist
-f, --filename string display a single file of the gist
-r, --raw do not try and render markdown
-w, --web open gist in browser
gh issue <command>
Manage issues
gh issue close {<number> | <url>}
Close issue
gh issue comment {<number> | <url>} [flags]
Create a new issue comment
-b, --body string Supply a body. Will prompt for one otherwise.
-e, --editor Add body using editor
-w, --web Add body in browser
gh issue create [flags]
Create a new issue
-a, --assignee login Assign people by their login
-b, --body string Supply a body. Will prompt for one otherwise.
-l, --label name Add labels by name
-m, --milestone name Add the issue to a milestone by name
-p, --project name Add the issue to projects by name
--recover string Recover input from a failed run of create
-t, --title string Supply a title. Will prompt for one otherwise.
-w, --web Open the browser to create an issue
gh issue list [flags]
List and filter issues in this repository
-a, --assignee string Filter by assignee
-A, --author string Filter by author
-l, --label strings Filter by labels
-L, --limit int Maximum number of issues to fetch (default 30)
--mention string Filter by mention
-m, --milestone number Filter by milestone number or `title`
-s, --state string Filter by state: {open|closed|all} (default "open")
-w, --web Open the browser to list the issue(s)
gh issue reopen {<number> | <url>}
Reopen issue
gh issue status
Show status of relevant issues
gh issue view {<number> | <url>} [flags]
View an issue
-c, --comments View issue comments
-w, --web Open an issue in the browser
gh pr <command>
Manage pull requests
gh pr checkout {<number> | <url> | <branch>} [flags]
Check out a pull request in git
--recurse-submodules Update all active submodules (recursively)
gh pr checks [<number> | <url> | <branch>] [flags]
Show CI status for a single pull request
-w, --web Open the web browser to show details about checks
gh pr close {<number> | <url> | <branch>} [flags]
Close a pull request
-d, --delete-branch Delete the local and remote branch after close
gh pr comment [<number> | <url> | <branch>] [flags]
Create a new pr comment
-b, --body string Supply a body. Will prompt for one otherwise.
-e, --editor Add body using editor
-w, --web Add body in browser
gh pr create [flags]
Create a pull request
-a, --assignee login Assign people by their login
-B, --base branch The branch into which you want your code merged
-b, --body string Body for the pull request
-d, --draft Mark pull request as a draft
-f, --fill Do not prompt for title/body and just use commit info
-H, --head branch The branch that contains commits for your pull request (default: current branch)
-l, --label name Add labels by name
-m, --milestone name Add the pull request to a milestone by name
--no-maintainer-edit Disable maintainer's ability to modify pull request
-p, --project name Add the pull request to projects by name
--recover string Recover input from a failed run of create
-r, --reviewer handle Request reviews from people or teams by their handle
-t, --title string Title for the pull request
-w, --web Open the web browser to create a pull request
gh pr diff [<number> | <url> | <branch>] [flags]
View changes in a pull request
--color string Use color in diff output: {always|never|auto} (default "auto")
gh pr list [flags]
List and filter pull requests in this repository
-a, --assignee string Filter by assignee
-B, --base string Filter by base branch
-l, --label strings Filter by labels
-L, --limit int Maximum number of items to fetch (default 30)
-s, --state string Filter by state: {open|closed|merged|all} (default "open")
-w, --web Open the browser to list the pull requests
gh pr merge [<number> | <url> | <branch>] [flags]
Merge a pull request
-d, --delete-branch Delete the local and remote branch after merge
-m, --merge Merge the commits with the base branch
-r, --rebase Rebase the commits onto the base branch
-s, --squash Squash the commits into one commit and merge it into the base branch
gh pr ready [<number> | <url> | <branch>]
Mark a pull request as ready for review
gh pr reopen {<number> | <url> | <branch>}
Reopen a pull request
gh pr review [<number> | <url> | <branch>] [flags]
Add a review to a pull request
-a, --approve Approve pull request
-b, --body string Specify the body of a review
-c, --comment Comment on a pull request
-r, --request-changes Request changes on a pull request
gh pr status
Show status of relevant pull requests
gh pr view [<number> | <url> | <branch>] [flags]
View a pull request
-c, --comments View pull request comments
-w, --web Open a pull request in the browser
gh release <command>
Manage GitHub releases
gh release create <tag> [<files>...] [flags]
Create a new release
-d, --draft Save the release as a draft instead of publishing it
-n, --notes string Release notes
-F, --notes-file file Read release notes from file
-p, --prerelease Mark the release as a prerelease
--target branch Target branch or commit SHA (default: main branch)
-t, --title string Release title
gh release delete <tag> [flags]
Delete a release
-y, --yes Skip the confirmation prompt
gh release download [<tag>] [flags]
Download release assets
-D, --dir string The directory to download files into (default ".")
-p, --pattern stringArray Download only assets that match a glob pattern
gh release list [flags]
List releases in a repository
-L, --limit int Maximum number of items to fetch (default 30)
gh release upload <tag> <files>... [flags]
Upload assets to a release
--clobber Overwrite existing assets of the same name
gh release view [<tag>] [flags]
View information about a release
-w, --web Open the release in the browser
gh repo <command>
Create, clone, fork, and view repositories
gh repo clone <repository> [<directory>] [-- <gitflags>...]
Clone a repository locally
gh repo create [<name>] [flags]
Create a new repository
-y, --confirm Confirm the submission directly
-d, --description string Description of repository
--enable-issues Enable issues in the new repository (default true)
--enable-wiki Enable wiki in the new repository (default true)
-h, --homepage string Repository home page URL
--internal Make the new repository internal
--private Make the new repository private
--public Make the new repository public
-t, --team string The name of the organization team to be granted access
-p, --template string Make the new repository based on a template repository
gh repo fork [<repository>] [flags]
Create a fork of a repository
--clone Clone the fork {true|false}
--remote Add remote for fork {true|false}
--remote-name string Specify a name for a fork's new remote. (default "origin")
gh repo view [<repository>] [flags]
View a repository
-b, --branch string View a specific branch of the repository
-w, --web Open a repository in the browser
gh secret <command>
Manage GitHub secrets
gh secret list [flags]
List secrets
-o, --org string List secrets for an organization
gh secret remove <secret-name> [flags]
Remove an organization or repository secret
-o, --org string List secrets for an organization
gh secret set <secret-name> [flags]
Create or update secrets
-b, --body string A value for the secret. Reads from STDIN if not specified.
-o, --org string List secrets for an organization
-r, --repos selected List of repository names for selected visibility
-v, --visibility all Set visibility for an organization secret: all, `private`, or `selected` (default "private")
Options inherited from parent commands
--help Show help for command