GitHub CLI
GitHub CLI

GitHub Repository

Clone a repository locally

$gh repo clone <repo>

Clone a specific owner's repository locally

$gh repo clone <owner/repo>

Clone a repository into a specified directory

$gh repo clone <owner/repo> <directory>

Perform a shallow clone of a repository

$gh repo clone <owner/repo> -- --depth 1

Create a new repository interactively

$gh repo create

Create a new repository with the specified name

$gh repo create <name>

Create a new public repository

$gh repo create --public

Create a new private repository

$gh repo create --private

Create a new internal repository

$gh repo create --internal

Create a repository from the current local directory

$gh repo create --source .

Create a repository and push local commits to it

$gh repo create --push

Create a repository and set a custom remote name

$gh repo create --remote <name>

Create a repository with a specific description

$gh repo create --description "<description>"

Create a repository with a specified homepage URL

$gh repo create --homepage <url>

Create a repository and grant access to a specific team

$gh repo create --team <name>

Create a repository with issues disabled

$gh repo create --disable-issues

Create a repository with the wiki disabled

$gh repo create --disable-wiki

Create a repository and push all local branches

$gh repo create --include-all-branches

Create a new repository using an existing template

$gh repo create --template <repo>

Create a repository and immediately clone it locally

$gh repo create --clone

Create a repository with a specific gitignore template

$gh repo create --gitignore <template>

Create a repository with a specific open source license

$gh repo create --license <license>

Publish the current directory as a new public repository

$gh repo create <name> --public --source . --push

Create a private repository with a name and description

$gh repo create <name> --private --description "<description>"

Create a public repository and clone it locally

$gh repo create <name> --public --clone

View details of the current repository

$gh repo view

View details of a specific repository

$gh repo view <owner/repo>

Open the current repository in the web browser

$gh repo view --web

Open a specific repository in the web browser

$gh repo view <owner/repo> --web

Output specific repository details in JSON format

$gh repo view --json <fields>

Output repository name, description, and URL in JSON

$gh repo view --json name,description,url

List repositories owned by the authenticated user

$gh repo list

List repositories owned by a specific user or org

$gh repo list <owner>

List only public repositories

$gh repo list --public

List only private repositories

$gh repo list --private

List only forked repositories

$gh repo list --fork

List only non-forked (source) repositories

$gh repo list --source

List only archived repositories

$gh repo list --archived

Exclude archived repositories from the list

$gh repo list --no-archived

List repositories filtered by primary language

$gh repo list --language <language>

List repositories filtered by a specific topic

$gh repo list --topic <topic>

Limit the number of repositories listed

$gh repo list --limit <number>

Output repository list in JSON format with specific fields

$gh repo list --json <fields>

Fork the current repository

$gh repo fork

Fork a specific repository

$gh repo fork <repo>

Fork a repository and clone it locally

$gh repo fork --clone

Fork and add a remote for the fork

$gh repo fork --remote

Fork and set a custom remote name for the fork

$gh repo fork --remote-name <name>

Fork a repository into a specific organization

$gh repo fork --org <org>

Fork a repository and give the fork a new name

$gh repo fork --fork-name <name>

Fork, clone locally, and set up remotes automatically

$gh repo fork <repo> --clone --remote

Delete the current repository interactively

$gh repo delete

Delete a specific repository interactively

$gh repo delete <owner/repo>

Delete a repository bypassing the confirmation prompt

$gh repo delete <owner/repo> --yes

Rename the current repository interactively

$gh repo rename

Rename the current repository to a new name

$gh repo rename <new-name>

Rename a specific repository to a new name

$gh repo rename <new-name> --repo <owner/repo>

Rename the repository bypassing the confirmation prompt

$gh repo rename <new-name> --yes

Edit repository settings interactively

$gh repo edit

Update the repository's description

$gh repo edit --description "<description>"

Update the repository's homepage URL

$gh repo edit --homepage <url>

Change the repository visibility to public

$gh repo edit --visibility public

Change the repository visibility to private

$gh repo edit --visibility private

Change the repository visibility to internal

$gh repo edit --visibility internal

Enable issues for the repository

$gh repo edit --enable-issues

Disable issues for the repository

$gh repo edit --disable-issues

Enable the wiki for the repository

$gh repo edit --enable-wiki

Disable the wiki for the repository

$gh repo edit --disable-wiki

Enable discussions for the repository

$gh repo edit --enable-discussions

Disable discussions for the repository

$gh repo edit --disable-discussions

Enable projects for the repository

$gh repo edit --enable-projects

Disable projects for the repository

$gh repo edit --disable-projects

Add a topic to the repository

$gh repo edit --add-topic <topic>

Remove a topic from the repository

$gh repo edit --remove-topic <topic>

Set the default branch for the repository

$gh repo edit --default-branch <branch>

Allow squash merging for pull requests

$gh repo edit --allow-squash-merge

Allow merge commits for pull requests

$gh repo edit --allow-merge-commit

Allow rebase merging for pull requests

$gh repo edit --allow-rebase-merge

Automatically delete head branches after PR merge

$gh repo edit --delete-branch-on-merge

Mark the repository as a template repository

$gh repo edit --template

Enable auto-merge functionality for PRs

$gh repo edit --enable-auto-merge

Archive the current repository interactively

$gh repo archive

Archive a specific repository interactively

$gh repo archive <owner/repo>

Archive a repository bypassing the confirmation prompt

$gh repo archive <owner/repo> --yes

Unarchive the current repository interactively

$gh repo unarchive

Unarchive a specific repository interactively

$gh repo unarchive <owner/repo>

Unarchive a repository bypassing the confirmation prompt

$gh repo unarchive <owner/repo> --yes

Sync the local repository with its remote parent

$gh repo sync

Sync a specific repository with its parent

$gh repo sync <owner/repo>

Sync a specific branch of the repository

$gh repo sync --branch <branch>

Forcefully sync the repository, overwriting local changes

$gh repo sync --force

Sync the repository from a specific source repository

$gh repo sync --source <repo>

List deploy keys for the repository

$gh repo deploy-key list

Add a new deploy key from a file

$gh repo deploy-key add <key-file>

Add a new deploy key with a specific title

$gh repo deploy-key add <key-file> --title "<title>"

Add a deploy key with write access enabled

$gh repo deploy-key add <key-file> --allow-write

Delete a deploy key by its ID

$gh repo deploy-key delete <key-id>

GitHub Pull Request

List open pull requests for the current repository

$gh pr list

List only open pull requests

$gh pr list --state open

List only closed (unmerged) pull requests

$gh pr list --state closed

List only merged pull requests

$gh pr list --state merged

List all pull requests regardless of state

$gh pr list --state all

List pull requests created by a specific user

$gh pr list --author <username>

List pull requests assigned to a specific user

$gh pr list --assignee <username>

List pull requests with a specific label

$gh pr list --label <label>

List pull requests targeting a specific base branch

$gh pr list --base <branch>

List pull requests originating from a specific head branch

$gh pr list --head <branch>

Limit the number of pull requests displayed

$gh pr list --limit <number>

List pull requests matching a search query

$gh pr list --search <query>

Open the list of pull requests in the web browser

$gh pr list --web

Output pull request details in JSON format

$gh pr list --json <fields>

Format the PR list output using a Go template

$gh pr list --template <template>

List only draft pull requests

$gh pr list --draft

List pull requests for a specific repository

$gh pr list --repo <owner/repo>

View details of the pull request for the current branch

$gh pr view

View details of a specific pull request by number

$gh pr view <number>

View details of a pull request associated with a branch

$gh pr view <branch>

Open the current branch's PR in the web browser

$gh pr view --web

Open a specific PR in the web browser

$gh pr view --web <number>

Output specific details of a PR in JSON format

$gh pr view --json <fields>

Parse PR JSON output using a jq expression

$gh pr view --json <fields> --jq <expression>

View the current branch's PR along with its comments

$gh pr view --comments

View a specific PR and its comments

$gh pr view <number> --comments

Create a new pull request interactively

$gh pr create

Create a pull request with a specific title

$gh pr create --title "<title>"

Create a pull request with a specific description body

$gh pr create --body "<body>"

Create a pull request targeting a specific base branch

$gh pr create --base <branch>

Create a pull request from a specific head branch

$gh pr create --head <branch>

Create a pull request as a draft

$gh pr create --draft

Continue creating the pull request in the web browser

$gh pr create --web

Automatically fill PR title and body from commit info

$gh pr create --fill

Fill PR title/body using detailed commit messages

$gh pr create --fill-verbose

Create a PR and request a review from a specific user

$gh pr create --reviewer <username>

Create a PR and assign it to a specific user

$gh pr create --assignee <username>

Create a PR and attach a specific label

$gh pr create --label <label>

Create a PR and assign it to a milestone

$gh pr create --milestone <milestone>

Create a PR and add it to a project board

$gh pr create --project <project>

Create a PR in a different repository

$gh pr create --repo <owner/repo>

Create a PR from a specific branch targeting main

$gh pr create --base main --head <branch>

Create a titled PR from a specific branch to main

$gh pr create --base main --head <branch> --title "<title>"

Create a fully populated PR from a specific branch to main

$gh pr create --base main --head <branch> --title "<title>" --body "<body>"

Create a fully populated draft PR to main

$gh pr create --base main --head <branch> --title "<title>" --body "<body>" --draft

Create a PR with details and request a reviewer

$gh pr create --base main --head <branch> --title "<title>" --body "<body>" --reviewer <username>

Create a PR with details and assign a label

$gh pr create --base main --head <branch> --title "<title>" --body "<body>" --label <label>

Create a PR with details and assign a user

$gh pr create --base main --head <branch> --title "<title>" --body "<body>" --assignee <username>

Create a PR with all details, reviewers, and assignees

$gh pr create --base main --head <branch> --title "<title>" --body "<body>" --reviewer <username> --assignee <username>

Create a PR reading the body text from a file

$gh pr create --title "<title>" --body-file <file>

Quickly create a draft PR using commit info

$gh pr create --fill --draft

Merge the pull request for the current branch interactively

$gh pr merge

Merge a specific pull request interactively

$gh pr merge <number>

Merge the PR using a standard merge commit

$gh pr merge --merge

Merge the PR by squashing commits

$gh pr merge --squash

Merge the PR by rebasing commits

$gh pr merge --rebase

Merge the PR and delete the local and remote branch

$gh pr merge --delete-branch

Enable auto-merge to trigger when requirements are met

$gh pr merge --auto

Disable previously set auto-merge for the PR

$gh pr merge --disable-auto

Squash merge a specific PR and delete its branch

$gh pr merge <number> --squash --delete-branch

Create a merge commit for a PR and delete its branch

$gh pr merge <number> --merge --delete-branch

Rebase merge a specific PR and delete its branch

$gh pr merge <number> --rebase --delete-branch

Squash merge with a custom commit title and body

$gh pr merge --squash --subject "<title>" --body "<body>"

Merge a PR using administrator privileges to bypass rules

$gh pr merge --admin

Close the pull request for the current branch

$gh pr close

Close a specific pull request without merging

$gh pr close <number>

Close a PR and leave a closing comment

$gh pr close <number> --comment "<comment>"

Close a PR and delete its associated branch

$gh pr close <number> --delete-branch

Close a PR, leave a comment, and delete the branch

$gh pr close <number> --comment "<comment>" --delete-branch

Reopen a previously closed pull request for the current branch

$gh pr reopen

Reopen a specific closed pull request

$gh pr reopen <number>

Reopen a pull request and add a comment

$gh pr reopen <number> --comment "<comment>"

Checkout the pull request for the current branch

$gh pr checkout

Checkout a specific pull request branch locally

$gh pr checkout <number>

Checkout a PR into a specific new local branch name

$gh pr checkout <number> --branch <name>

Force checkout a PR, overwriting local changes

$gh pr checkout <number> --force

Checkout a PR in a detached HEAD state

$gh pr checkout <number> --detach

Checkout a PR and update its submodules

$gh pr checkout <number> --recurse-submodules

View the diff of the PR for the current branch

$gh pr diff

View the code diff for a specific pull request

$gh pr diff <number>

Output the PR diff in patch format

$gh pr diff --patch

List only the names of files changed in the PR

$gh pr diff --name-only

Force colored output for the PR diff

$gh pr diff --color always

Disable colored output for the PR diff

$gh pr diff --color never

Get the diff of a specific PR in patch format

$gh pr diff <number> --patch

Edit details of the current branch's PR interactively

$gh pr edit

Edit a specific pull request interactively

$gh pr edit <number>

Change the title of the pull request

$gh pr edit --title "<title>"

Update the description body of the pull request

$gh pr edit --body "<body>"

Change the base branch the pull request is targeting

$gh pr edit --base <branch>

Request a review from a specific user on the PR

$gh pr edit --add-reviewer <username>

Remove a review request for a specific user

$gh pr edit --remove-reviewer <username>

Assign the pull request to a specific user

$gh pr edit --add-assignee <username>

Unassign a specific user from the pull request

$gh pr edit --remove-assignee <username>

Add a label to the pull request

$gh pr edit --add-label <label>

Remove a label from the pull request

$gh pr edit --remove-label <label>

Add the pull request to a specific project

$gh pr edit --add-project <project>

Remove the pull request from a project

$gh pr edit --remove-project <project>

Set the milestone for the pull request

$gh pr edit --milestone <milestone>

Mark a draft pull request as ready for review

$gh pr edit --ready

Convert a standard pull request back to a draft

$gh pr edit --draft

Edit the title and body of a specific PR

$gh pr edit <number> --title "<title>" --body "<body>"

Add a label and reviewer to a specific PR

$gh pr edit <number> --add-label <label> --add-reviewer <username>

Add a review to the pull request for the current branch

$gh pr review

Add a review to a specific pull request

$gh pr review <number>

Approve the pull request

$gh pr review --approve

Request changes on the pull request

$gh pr review --request-changes

Submit a general comment review on the pull request

$gh pr review --comment

Submit a review with specific body text

$gh pr review --body "<body>"

Approve a specific pull request

$gh pr review <number> --approve

Request changes on a specific PR with an explanation

$gh pr review <number> --request-changes --body "<body>"

Leave a review comment on a specific PR

$gh pr review <number> --comment --body "<body>"

Approve a specific PR and leave a comment

$gh pr review <number> --approve --body "<body>"

Show CI status for the current branch's PR

$gh pr checks

Show CI status for a specific PR

$gh pr checks <number>

Watch PR checks and wait until they complete

$gh pr checks --watch

Exit the watch process immediately if any check fails

$gh pr checks --fail-fast

Show status only for required checks

$gh pr checks --required

Set the refresh interval when watching checks

$gh pr checks --interval <seconds>

Watch the CI checks for a specific PR

$gh pr checks <number> --watch

Watch checks for a PR and exit quickly on failure

$gh pr checks <number> --watch --fail-fast

Add a comment to the current branch's PR

$gh pr comment

Add a comment to a specific PR interactively

$gh pr comment <number>

Add a specific comment to the current PR

$gh pr comment --body "<comment>"

Add a specific comment text to a specific PR

$gh pr comment <number> --body "<comment>"

Add a comment to a PR using the contents of a file

$gh pr comment <number> --body-file <file>

Edit your last comment on a specific PR

$gh pr comment <number> --edit-last

Delete your last comment on a specific PR

$gh pr comment <number> --delete-last

Open a specific PR in the browser to leave a comment

$gh pr comment <number> --web

Mark the current draft PR as ready for review

$gh pr ready

Mark a specific draft PR as ready for review

$gh pr ready <number>

Convert a specific PR back to draft status

$gh pr ready <number> --undo

Lock conversation on the current branch's PR

$gh pr lock

Lock conversation on a specific PR

$gh pr lock <number>

Lock a PR conversation as off-topic

$gh pr lock <number> --reason off-topic

Lock a PR conversation because it is resolved

$gh pr lock <number> --reason resolved

Lock a PR conversation due to spam

$gh pr lock <number> --reason spam

Lock a PR conversation because it is too heated

$gh pr lock <number> --reason too heated

Unlock conversation on the current branch's PR

$gh pr unlock

Unlock conversation on a specific PR

$gh pr unlock <number>

List all projects for the current repository or organization

$gh project list

List projects for a specific user or organization

$gh project list --owner <owner>

List projects and output the result in JSON format

$gh project list --format json

View details of a specific project by number

$gh project view <number>

View a project owned by a specific user or organization

$gh project view <number> --owner <owner>

View details of a specific project in JSON format

$gh project view <number> --format json

Create a new project for a specific owner with a title

$gh project create --owner <owner> --title "<title>"

Rename or edit the title of an existing project

$gh project edit <number> --owner <owner> --title "<title>"

Delete a specific project permanently

$gh project delete <number> --owner <owner>

Duplicate a project to a new owner with a new title

$gh project copy <number> --source-owner <owner> --target-owner <owner> --title "<title>"

Close a specific project without deleting it

$gh project close <number> --owner <owner>

Link a project to a specific repository

$gh project link <number> --owner <owner> --repo <owner/repo>

Remove a repository link from a project

$gh project unlink <number> --owner <owner> --repo <owner/repo>

List all items (issues/PRs) within a project

$gh project item-list <number>

List items in a specific owner's project

$gh project item-list <number> --owner <owner>

Add an issue or PR to a project using its URL

$gh project item-add <number> --owner <owner> --url <issue-or-pr-url>

Delete a specific item from a project

$gh project item-delete <number> --owner <owner> --id <item-id>

Edit a specific field value for an item in a project

$gh project item-edit --id <item-id> --field-id <field-id> --project-id <project-id> --text "<value>"

Archive an item within a project

$gh project item-archive <number> --owner <owner> --id <item-id>

List all custom fields defined in a project

$gh project field-list <number>

List fields for a specific owner's project

$gh project field-list <number> --owner <owner>

Create a new text field in a project

$gh project field-create <number> --owner <owner> --name "<name>" --data-type TEXT

Delete a custom field from a project

$gh project field-delete <number> --owner <owner> --id <field-id>

List all columns (for classic projects)

$gh project column-list <number>

GitHub Issue

List open issues for the current repository

$gh issue list

List only open issues

$gh issue list --state open

List only closed issues

$gh issue list --state closed

List all issues regardless of open/closed state

$gh issue list --state all

List issues created by a specific user

$gh issue list --author <username>

List issues assigned to a specific user

$gh issue list --assignee <username>

List issues that have a specific label attached

$gh issue list --label <label>

List issues assigned to a specific milestone

$gh issue list --milestone <milestone>

Limit the maximum number of issues displayed

$gh issue list --limit <number>

Search for issues matching a specific text query

$gh issue list --search <query>

Open the issue list in the web browser

$gh issue list --web

Output issue details in JSON format

$gh issue list --json <fields>

Format the issue list using a custom Go template

$gh issue list --template <template>

List issues where a specific user is mentioned

$gh issue list --mention <username>

List issues for a specific repository

$gh issue list --repo <owner/repo>

View details of an issue interactively

$gh issue view

View details of a specific issue by number

$gh issue view <number>

Open the current issue in the web browser

$gh issue view --web

Open a specific issue in the web browser

$gh issue view <number> --web

Output specific details of an issue in JSON format

$gh issue view --json <fields>

View an issue along with its comments

$gh issue view --comments

View a specific issue and all of its comments

$gh issue view <number> --comments

Create a new issue interactively

$gh issue create

Create a new issue with a specific title

$gh issue create --title "<title>"

Create a new issue with a specific description body

$gh issue create --body "<body>"

Create a new issue and assign it to a user

$gh issue create --assignee <username>

Create a new issue and add a label to it

$gh issue create --label <label>

Create a new issue and assign it to a milestone

$gh issue create --milestone <milestone>

Create a new issue and add it to a project

$gh issue create --project <project>

Continue creating an issue in the web browser

$gh issue create --web

Create an issue in a different repository

$gh issue create --repo <owner/repo>

Create an issue instantly with a title and body

$gh issue create --title "<title>" --body "<body>"

Create an issue with a title, body, and label

$gh issue create --title "<title>" --body "<body>" --label <label>

Create an issue with a title, body, and assignee

$gh issue create --title "<title>" --body "<body>" --assignee <username>

Create a fully populated issue with labels and assignee

$gh issue create --title "<title>" --body "<body>" --label <label> --assignee <username>

Create an issue reading the body content from a file

$gh issue create --title "<title>" --body-file <file>

Close an issue interactively

$gh issue close

Close a specific issue by number

$gh issue close <number>

Close an issue and leave a closing comment

$gh issue close <number> --comment "<comment>"

Close an issue marking it as successfully completed

$gh issue close <number> --reason completed

Close an issue marking it as not planned/won't fix

$gh issue close <number> --reason not-planned

Reopen a closed issue interactively

$gh issue reopen

Reopen a specific closed issue

$gh issue reopen <number>

Reopen an issue and add a comment

$gh issue reopen <number> --comment "<comment>"

Edit an issue interactively

$gh issue edit

Edit a specific issue interactively

$gh issue edit <number>

Change the title of an issue

$gh issue edit --title "<title>"

Change the description body of an issue

$gh issue edit --body "<body>"

Assign a user to an existing issue

$gh issue edit --add-assignee <username>

Unassign a user from an existing issue

$gh issue edit --remove-assignee <username>

Add a new label to an existing issue

$gh issue edit --add-label <label>

Remove a label from an existing issue

$gh issue edit --remove-label <label>

Add an existing issue to a project

$gh issue edit --add-project <project>

Remove an issue from a project

$gh issue edit --remove-project <project>

Set or change the milestone for an issue

$gh issue edit --milestone <milestone>

Update both the title and body of a specific issue

$gh issue edit <number> --title "<title>" --body "<body>"

Add a comment to an issue interactively

$gh issue comment

Add a comment to a specific issue interactively

$gh issue comment <number>

Submit a comment using the provided text body

$gh issue comment --body "<comment>"

Add a specific text comment to a specific issue

$gh issue comment <number> --body "<comment>"

Comment on an issue using the contents of a file

$gh issue comment <number> --body-file <file>

Edit your most recent comment on an issue

$gh issue comment <number> --edit-last

Delete your most recent comment on an issue

$gh issue comment <number> --delete-last

Open an issue in the browser to leave a comment

$gh issue comment <number> --web

Delete an issue permanently interactively

$gh issue delete

Delete a specific issue permanently

$gh issue delete <number>

Delete an issue bypassing the confirmation prompt

$gh issue delete <number> --yes

Create a branch for an issue interactively

$gh issue develop

Create a linked branch for a specific issue

$gh issue develop <number>

Create a branch for an issue with a specific name

$gh issue develop <number> --name <branch>

Create a branch for an issue originating from a specific base

$gh issue develop <number> --base <branch>

Create a branch for an issue and check it out locally

$gh issue develop <number> --checkout

Create a named branch for an issue and check it out

$gh issue develop <number> --name <branch> --checkout

Lock conversation on an issue interactively

$gh issue lock

Lock conversation on a specific issue

$gh issue lock <number>

Lock an issue conversation marking it off-topic

$gh issue lock <number> --reason off-topic

Lock an issue conversation marking it resolved

$gh issue lock <number> --reason resolved

Lock an issue conversation marking it as spam

$gh issue lock <number> --reason spam

Unlock conversation on an issue interactively

$gh issue unlock

Unlock conversation on a specific issue

$gh issue unlock <number>

Pin an issue to the repository's issue list

$gh issue pin

Pin a specific issue by number

$gh issue pin <number>

Unpin an issue from the repository's issue list

$gh issue unpin

Unpin a specific issue by number

$gh issue unpin <number>

Transfer an issue to another repository interactively

$gh issue transfer

Transfer a specific issue to a destination repository

$gh issue transfer <number> <destination-repo>

GitHub Workflow & Run

List GitHub Actions workflows in the current repository

$gh workflow list

List all workflows, including disabled ones

$gh workflow list --all

List workflows for a specific repository

$gh workflow list --repo <owner/repo>

Output workflow details in JSON format

$gh workflow list --json <fields>

View details of a workflow interactively

$gh workflow view

View details of a specific workflow

$gh workflow view <workflow>

Open a workflow in the web browser

$gh workflow view --web

Open a specific workflow in the web browser

$gh workflow view <workflow> --web

View the YAML configuration of a workflow

$gh workflow view --yaml

View the YAML file of a specific workflow

$gh workflow view <workflow> --yaml

View a workflow file as it exists on a specific branch

$gh workflow view --ref <branch>

Enable a disabled workflow interactively

$gh workflow enable

Enable a specific disabled workflow

$gh workflow enable <workflow>

Disable an active workflow interactively

$gh workflow disable

Disable a specific active workflow

$gh workflow disable <workflow>

Run a workflow manually interactively

$gh workflow run

Trigger a specific workflow manually

$gh workflow run <workflow>

Trigger a workflow to run on a specific branch

$gh workflow run <workflow> --ref <branch>

Run a workflow passing a specific input parameter

$gh workflow run <workflow> --field <key>=<value>

Run a workflow passing raw string input parameters

$gh workflow run <workflow> --raw-field <key>=<value>

Run a workflow and accept inputs from a JSON string

$gh workflow run <workflow> --json

Run a workflow on a branch with specific inputs

$gh workflow run <workflow> --ref <branch> --field <key>=<value>

List recent workflow runs for the repository

$gh run list

List runs for a specific workflow

$gh run list --workflow <workflow>

List workflow runs executed on a specific branch

$gh run list --branch <branch>

List workflow runs triggered by a specific user

$gh run list --user <username>

List workflow runs matching a specific status (e.g., failed)

$gh run list --status <status>

List workflow runs triggered by a specific event (e.g., push)

$gh run list --event <event>

List workflow runs associated with a specific commit

$gh run list --commit <sha>

Limit the number of workflow runs returned

$gh run list --limit <number>

Output workflow runs data in JSON format

$gh run list --json <fields>

List workflow runs created on or after a specific date

$gh run list --created <date>

View details of a workflow run interactively

$gh run view

View details of a specific workflow run

$gh run view <run-id>

Open a workflow run in the web browser

$gh run view --web

Open a specific workflow run in the web browser

$gh run view <run-id> --web

View the complete log output of a workflow run

$gh run view --log

View the logs for a specific workflow run

$gh run view <run-id> --log

View only the failed log steps of a workflow run

$gh run view --log-failed

View failed logs for a specific workflow run

$gh run view <run-id> --log-failed

Exit with a non-zero status if the run failed

$gh run view --exit-status

Check the exit status of a specific workflow run programmatically

$gh run view <run-id> --exit-status

View details for a specific job within a run

$gh run view --job <job-id>

View detailed information about a run's steps

$gh run view --verbose

View verbose details for a specific workflow run

$gh run view <run-id> --verbose

Watch a workflow run's progress interactively

$gh run watch

Watch the progress of a specific workflow run

$gh run watch <run-id>

Watch a run and exit with its final status code

$gh run watch --exit-status

Set the polling interval while watching a run

$gh run watch --interval <seconds>

Watch a specific run and return its exit code upon completion

$gh run watch <run-id> --exit-status

Re-run a workflow run interactively

$gh run rerun

Re-run a specific workflow run completely

$gh run rerun <run-id>

Re-run only the failed jobs in a workflow run

$gh run rerun --failed-only

Re-run failed jobs for a specific workflow run

$gh run rerun <run-id> --failed-only

Re-run a specific job within a workflow run

$gh run rerun --job <job-id>

Re-run a workflow run with runner debug logging enabled

$gh run rerun --debug

Re-run a specific run with debug logging

$gh run rerun <run-id> --debug

Cancel a workflow run interactively

$gh run cancel

Cancel a specific in-progress workflow run

$gh run cancel <run-id>

Delete a workflow run interactively

$gh run delete

Delete a specific workflow run permanently

$gh run delete <run-id>

Delete a workflow run bypassing the confirmation prompt

$gh run delete <run-id> --yes

Download artifacts from a workflow run interactively

$gh run download

Download all artifacts generated by a specific run

$gh run download <run-id>

Download a specific named artifact from a run

$gh run download <run-id> --name <artifact-name>

Download a run's artifacts into a specific directory

$gh run download <run-id> --dir <directory>

Download artifacts matching a glob pattern from a run

$gh run download <run-id> --pattern <glob>

GitHub Auth & Config

Log in to a GitHub account interactively

$gh auth login

Log in to GitHub via the web browser

$gh auth login --web

Log in using a personal access token provided via standard input

$gh auth login --with-token

Log in to a specific GitHub Enterprise Server instance

$gh auth login --hostname <hostname>

Log in and request specific additional OAuth scopes

$gh auth login --scopes <scopes>

Log in and set the preferred Git protocol (ssh or https)

$gh auth login --git-protocol <protocol>

Log out of your GitHub account

$gh auth logout

Log out from a specific GitHub Enterprise Server

$gh auth logout --hostname <hostname>

Check your current authentication status

$gh auth status

Check auth status for a specific enterprise host

$gh auth status --hostname <hostname>

Display the active authentication token in the status output

$gh auth status --show-token

Print the current authentication token to standard output

$gh auth token

Print the token for a specific enterprise host

$gh auth token --hostname <hostname>

Refresh the current authentication session

$gh auth refresh

Refresh auth session to request additional scopes

$gh auth refresh --scopes <scopes>

Refresh auth session for a specific enterprise host

$gh auth refresh --hostname <hostname>

Configure Git to use GitHub CLI as a credential helper

$gh auth setup-git

Configure Git credential helper for a specific host

$gh auth setup-git --hostname <hostname>

List all configured settings for the GitHub CLI

$gh config list

Retrieve the value of a specific configuration key

$gh config get <key>

Set a specific configuration key to a given value

$gh config set <key> <value>

Set a configuration key for a specific host

$gh config set --host <hostname> <key> <value>

Set the default text editor for the GitHub CLI

$gh config set editor <editor>

Set the default web browser for the GitHub CLI

$gh config set browser <browser>

Set HTTPS as the default Git protocol

$gh config set git_protocol https

Set SSH as the default Git protocol

$gh config set git_protocol ssh

Enable interactive prompts for the CLI

$gh config set prompt enabled

Disable interactive prompts for scripting

$gh config set prompt disabled

Set a custom terminal pager for long outputs

$gh config set pager <pager>

GitHub Gist & Release

List releases for the current repository

$gh release list

Limit the number of releases shown

$gh release list --limit <number>

List releases but hide drafts

$gh release list --exclude-drafts

List releases but hide pre-releases

$gh release list --exclude-pre-releases

Output release list in JSON format

$gh release list --json <fields>

View details of the latest release

$gh release view

View details of a release by its tag name

$gh release view <tag>

Open the latest release in the web browser

$gh release view --web

Open a specific release in the web browser

$gh release view <tag> --web

Output release details in JSON format

$gh release view --json <fields>

Create a new release interactively

$gh release create

Create a release for a specific tag

$gh release create <tag>

Create a release and upload assets to it

$gh release create <tag> <files>

Create a release with a custom title

$gh release create <tag> --title "<title>"

Create a release with specific release notes

$gh release create <tag> --notes "<notes>"

Create a release using release notes from a file

$gh release create <tag> --notes-file <file>

Create a release but save it as a draft

$gh release create <tag> --draft

Create a release and mark it as a pre-release

$gh release create <tag> --prerelease

Create a release and explicitly mark it as the latest

$gh release create <tag> --latest

Create a release targeting a specific branch or commit

$gh release create <tag> --target <branch-or-commit>

Create a release and auto-generate notes based on PRs

$gh release create <tag> --generate-notes

Generate notes starting from a previous specific tag

$gh release create <tag> --notes-start-tag <tag>

Create a release and start a discussion in a specific category

$gh release create <tag> --discussion-category <category>

Create a complete release with assets, title, and notes

$gh release create <tag> <files> --title "<title>" --notes "<notes>"

Create a release with assets and auto-generated notes

$gh release create <tag> <files> --title "<title>" --generate-notes

Create a draft pre-release

$gh release create <tag> --draft --prerelease

Edit the latest release interactively

$gh release edit

Edit a specific release by tag interactively

$gh release edit <tag>

Update the title of an existing release

$gh release edit <tag> --title "<title>"

Update the release notes of an existing release

$gh release edit <tag> --notes "<notes>"

Convert a published release to a draft

$gh release edit <tag> --draft

Convert a published release to a pre-release

$gh release edit <tag> --prerelease

Set an existing release as the latest release

$gh release edit <tag> --latest

Publish a release that is currently a draft

$gh release edit <tag> --draft=false

Change the tag associated with an existing release

$gh release edit <tag> --tag <new-tag>

Change the target commitish for an existing release

$gh release edit <tag> --target <branch-or-commit>

Delete a release interactively

$gh release delete

Delete a specific release by its tag

$gh release delete <tag>

Delete a release bypassing the confirmation prompt

$gh release delete <tag> --yes

Delete a release and its associated git tag

$gh release delete <tag> --cleanup-tag

Force delete a release and its git tag simultaneously

$gh release delete <tag> --yes --cleanup-tag

Download assets from the latest release

$gh release download

Download assets from the latest release

$gh release download

Download assets from a specific tagged release

$gh release download <tag>

Download latest release assets matching a glob pattern

$gh release download --pattern <glob>

Download specific release assets matching a pattern

$gh release download <tag> --pattern <glob>

Download release assets into a specific directory

$gh release download <tag> --dir <directory>

Download the release source code as a ZIP archive

$gh release download <tag> --archive zip

Download the release source code as a tarball

$gh release download <tag> --archive tar.gz

Download matching assets from a release to a specific folder

$gh release download <tag> --pattern <glob> --dir <directory>

Download assets and overwrite existing files locally

$gh release download --clobber <tag>

Upload assets to a release interactively

$gh release upload

Upload one or more files to a specific release

$gh release upload <tag> <files>

Upload files to a release, overwriting existing assets of the same name

$gh release upload <tag> <files> --clobber

List your GitHub gists

$gh gist list

Limit the number of gists displayed

$gh gist list --limit <number>

List only your public gists

$gh gist list --public

List only your secret gists

$gh gist list --secret

View the content of a specific gist

$gh gist view <gist-id>

Open a specific gist in the web browser

$gh gist view <gist-id> --web

Output the raw content of a gist without formatting

$gh gist view <gist-id> --raw

View a specific file from a multi-file gist

$gh gist view <gist-id> --filename <file>

Create a new gist interactively

$gh gist create

Create a new gist from a local file

$gh gist create <file>

Create a multi-file gist from local files

$gh gist create <file1> <file2>

Create a public gist (default is secret)

$gh gist create --public

Create a gist with a specific description

$gh gist create --desc "<description>"

Create a described, public gist from a file

$gh gist create <file> --public --desc "<description>"

Create a gist by reading content from standard input

$gh gist create -

Edit an existing gist interactively

$gh gist edit <gist-id>

Edit a specific file within an existing gist

$gh gist edit <gist-id> --filename <file>

Add a new file to an existing gist

$gh gist edit <gist-id> --add <file>

Remove a file from an existing gist

$gh gist edit <gist-id> --remove <file>

Update the description of an existing gist

$gh gist edit <gist-id> --desc "<description>"

Delete a gist permanently interactively

$gh gist delete <gist-id>

Delete a gist bypassing the confirmation prompt

$gh gist delete <gist-id> --yes

Clone a gist locally as a git repository

$gh gist clone <gist-id>

Clone a gist into a specified directory

$gh gist clone <gist-id> <directory>

Rename a file within an existing gist

$gh gist rename <gist-id> <old-filename> <new-filename>

GitHub Secret & Variable

List GitHub Actions secrets for the current repository

$gh secret list

List secrets for a specific organization

$gh secret list --org <org>

List secrets for a specific deployment environment

$gh secret list --env <environment>

List your personal Codespaces secrets

$gh secret list --user

Output secrets list in JSON format

$gh secret list --json <fields>

Create or update a secret interactively

$gh secret set <name>

Set a secret with a specific string value

$gh secret set <name> --body "<value>"

Set a secret reading the value from a file

$gh secret set <name> --env-file <file>

Create an organization-level secret

$gh secret set <name> --org <org>

Create an org secret visible to all repositories

$gh secret set <name> --org <org> --visibility all

Create an org secret visible only to private repositories

$gh secret set <name> --org <org> --visibility private

Create an org secret visible to specific repositories

$gh secret set <name> --org <org> --visibility selected

Create an org secret and assign it to specific repos

$gh secret set <name> --org <org> --repos <repo1,repo2>

Create an environment-specific secret

$gh secret set <name> --env <environment>

Create a personal Codespaces secret

$gh secret set <name> --user

Delete a repository secret

$gh secret delete <name>

Delete an organization secret

$gh secret delete <name> --org <org>

Delete an environment secret

$gh secret delete <name> --env <environment>

Delete a personal Codespaces secret

$gh secret delete <name> --user

List GitHub Actions variables for the repository

$gh variable list

List variables for an organization

$gh variable list --org <org>

List variables for a specific environment

$gh variable list --env <environment>

Output variables list in JSON format

$gh variable list --json <fields>

Create or update a variable interactively

$gh variable set <name>

Set a variable with a specific string value

$gh variable set <name> --body "<value>"

Create an organization-level variable

$gh variable set <name> --org <org>

Create an org variable visible to all repositories

$gh variable set <name> --org <org> --visibility all

Create an org variable visible to selected repositories

$gh variable set <name> --org <org> --visibility selected

Create an org variable and specify access for repos

$gh variable set <name> --org <org> --repos <repo1,repo2>

Create an environment-specific variable

$gh variable set <name> --env <environment>

Delete a repository variable

$gh variable delete <name>

Delete an organization variable

$gh variable delete <name> --org <org>

Delete an environment variable

$gh variable delete <name> --env <environment>

GitHub Label & Milestone

List all labels in the current repository

$gh label list

Output label data in JSON format

$gh label list --json <fields>

Search for specific labels by name or description

$gh label list --search <query>

Sort the label list in ascending order

$gh label list --order asc

Sort the label list in descending order

$gh label list --order desc

Sort labels by their creation date

$gh label list --sort created

Sort labels alphabetically by name

$gh label list --sort name

Create a new label with a random color

$gh label create <name>

Create a new label with a specific hex color

$gh label create <name> --color <hex>

Create a new label with a description

$gh label create <name> --description "<description>"

Update an existing label if it already exists

$gh label create <name> --force

Create a fully specified label with color and description

$gh label create <name> --color <hex> --description "<description>"

Edit an existing label interactively

$gh label edit <name>

Rename an existing label

$gh label edit <name> --name <new-name>

Change the hex color of an existing label

$gh label edit <name> --color <hex>

Update the description of an existing label

$gh label edit <name> --description "<description>"

Delete a label interactively

$gh label delete <name>

Delete a label bypassing the confirmation prompt

$gh label delete <name> --yes

Copy labels from a different repository into the current one

$gh label clone <source-repo>

Copy labels, overwriting matching existing labels

$gh label clone <source-repo> --force

GitHub API & Alias

Fetch milestones using the GitHub REST API

$gh api /repos/{owner}/{repo}/milestones

Create a new milestone via a POST API request

$gh api /repos/{owner}/{repo}/milestones --method POST --field title="<title>"

Make a custom GET request to a GitHub API endpoint

$gh api <endpoint>

Make an explicit GET request to an API endpoint

$gh api <endpoint> --method GET

Make a POST request to an API endpoint

$gh api <endpoint> --method POST

Make a PUT request to an API endpoint

$gh api <endpoint> --method PUT

Make a PATCH request to an API endpoint

$gh api <endpoint> --method PATCH

Make a DELETE request to an API endpoint

$gh api <endpoint> --method DELETE

Send a parameter payload with the API request

$gh api <endpoint> --field <key>=<value>

Send a raw string parameter payload with the API request

$gh api <endpoint> --raw-field <key>=<value>

Send a custom HTTP header with the API request

$gh api <endpoint> --header <key>:<value>

Automatically fetch all pages for a paginated API endpoint

$gh api <endpoint> --paginate

Filter the JSON response using a jq expression

$gh api <endpoint> --jq <expression>

Format the API response using a Go template

$gh api <endpoint> --template <template>

Send a request body read from a local file

$gh api <endpoint> --input <file>

Make an API request to a specific GitHub Enterprise server

$gh api <endpoint> --hostname <hostname>

Include HTTP response headers in the output

$gh api <endpoint> --include

Suppress the response body output

$gh api <endpoint> --silent

Cache the API response for a specified duration

$gh api <endpoint> --cache <duration>

Make a GitHub GraphQL API query

$gh api graphql -f query='<query>'

Fetch details of the currently authenticated user

$gh api /user

Fetch raw details of a specific repository via API

$gh api /repos/{owner}/{repo}

Fetch raw issues data for a repository via API

$gh api /repos/{owner}/{repo}/issues

Fetch raw pull requests data for a repository via API

$gh api /repos/{owner}/{repo}/pulls

Make a POST request, send fields, and filter response with jq

$gh api <endpoint> --method POST --field <key>=<value> --jq <expression>

List all configured custom aliases for the GitHub CLI

$gh alias list

Create a new alias that expands to a specific gh command

$gh alias set <name> <expansion>

Create an alias that executes a shell command

$gh alias set <name> --shell <expansion>

Delete a previously configured CLI alias

$gh alias delete <name>

Import aliases from a YAML configuration file

$gh alias import <file>

Import aliases from a file, overwriting existing ones

$gh alias import --clobber <file>

GitHub Codespace

List your active GitHub Codespaces

$gh codespace list

View details of an active Codespace interactively

$gh codespace view

View details of a specific Codespace

$gh codespace view --codespace <name>

Create a new Codespace interactively

$gh codespace create

Create a Codespace for a specific repository

$gh codespace create --repo <owner/repo>

Create a Codespace for a specific branch

$gh codespace create --branch <branch>

Create a Codespace using a specific machine type (e.g., standardLinux)

$gh codespace create --machine <type>

Create a Codespace using a specific devcontainer.json configuration

$gh codespace create --devcontainer-path <path>

Create a Codespace for a specific branch of a specific repository

$gh codespace create --repo <owner/repo> --branch <branch>

Delete a Codespace interactively

$gh codespace delete

Delete a specific Codespace by name

$gh codespace delete --codespace <name>

Delete all of your active Codespaces

$gh codespace delete --all

Delete Codespaces that have been inactive for N days

$gh codespace delete --days <n>

Open an interactive SSH session into a Codespace

$gh codespace ssh

SSH into a specific named Codespace

$gh codespace ssh --codespace <name>

Run a specific command over SSH within a Codespace

$gh codespace ssh -- <command>

Stop a running Codespace interactively

$gh codespace stop

Stop a specific running Codespace

$gh codespace stop --codespace <name>

Change the friendly display name of a Codespace

$gh codespace edit --codespace <name> --display-name "<name>"

Change the machine type (hardware) of an existing Codespace

$gh codespace edit --codespace <name> --machine <type>

List forwarded ports for an active Codespace

$gh codespace ports

List ports for a specific active Codespace

$gh codespace ports --codespace <name>

Forward a local port to a remote port on the Codespace

$gh codespace ports forward <local-port>:<remote-port>

Change the visibility of a Codespace port to public

$gh codespace ports visibility <port>:public

Tail the logs of a Codespace interactively

$gh codespace logs

Tail logs for a specific Codespace

$gh codespace logs --codespace <name>

Copy a file between your local machine and a Codespace

$gh codespace cp <source> <dest>

Recursively copy a directory to/from a Codespace

$gh codespace cp -r <source> <dest>

Rebuild the dev container for a Codespace

$gh codespace rebuild

Perform a full rebuild of a Codespace ignoring cache

$gh codespace rebuild --full

Open a Codespace in Visual Studio Code interactively

$gh codespace code

Open a specific Codespace in Visual Studio Code

$gh codespace code --codespace <name>

GitHub Cache & Organization

List GitHub Actions caches for the repository

$gh cache list

List caches matching a specific key

$gh cache list --key <key>

List caches associated with a specific branch/ref

$gh cache list --ref <ref>

Limit the number of cache entries returned

$gh cache list --limit <number>

Output cache data in JSON format

$gh cache list --json <fields>

Delete a specific Actions cache by its ID

$gh cache delete <id>

Delete all GitHub Actions caches for the repository

$gh cache delete --all

List organizations you belong to

$gh org list

Limit the number of organizations listed

$gh org list --limit <number>

Output your organization list in JSON format

$gh org list --json <fields>

GitHub Browse & Status

View status of relevant PRs, issues, and workflow runs

$gh status

View dashboard status excluding a specific repository

$gh status --exclude <owner/repo>

View dashboard status scoped to a specific organization

$gh status --org <org>

Open the current repository in the web browser

$gh browse

Open a specific issue or PR number in the browser

$gh browse <number>

Open a specific repository file in the web browser

$gh browse <file>

Open a specific branch of the repository in the browser

$gh browse --branch <branch>

Open a specific tag of the repository in the browser

$gh browse --tag <tag>

Open a specific commit URL in the browser

$gh browse --commit <commit>

Open the repository's projects board in the browser

$gh browse --projects

Open the repository's wiki page in the browser

$gh browse --wiki

Open a different specific repository in the browser

$gh browse --repo <owner/repo>

Print the URL to the console instead of opening the browser

$gh browse --no-browser

Open the repository settings page in the browser

$gh browse --settings

Open a specific file on a specific branch in the browser

$gh browse <file> --branch <branch>

GitHub Attestation

Verify the artifact attestation of a local file

$gh attestation verify <file>

Verify an artifact file against a specific repository

$gh attestation verify <file> --repo <owner/repo>

Verify an artifact file against a specific owner

$gh attestation verify <file> --owner <owner>

Verify an artifact using an explicit sigstore bundle

$gh attestation verify <file> --bundle <bundle>

Download an attestation bundle by subject digest

$gh attestation download <subject-digest>

Download an attestation bundle from a specific repo

$gh attestation download <subject-digest> --repo <owner/repo>

Download an attestation bundle matching a specific predicate type

$gh attestation download <subject-digest> --predicate-type <type>

GitHub Ruleset & Environment

Fetch all configured deployment environments via API

$gh api /repos/{owner}/{repo}/environments

Fetch details of a specific deployment environment

$gh api /repos/{owner}/{repo}/environments/<env-name>

Create or update a deployment environment via API

$gh api /repos/{owner}/{repo}/environments/<env-name> --method PUT

Delete a deployment environment via API

$gh api /repos/{owner}/{repo}/environments/<env-name> --method DELETE

List rulesets active on the current repository

$gh ruleset list

List rulesets configured for a specific organization

$gh ruleset list --org <org>

List rulesets including those inherited from parents

$gh ruleset list --parents

View details of a specific repository ruleset

$gh ruleset view <id>

View details of a specific organization ruleset

$gh ruleset view <id> --org <org>

Open a specific ruleset in the web browser

$gh ruleset view <id> --web

Evaluate which rulesets apply to a specific branch

$gh ruleset check <branch>

Check rules applied to the default branch

$gh ruleset check <branch> --default

GitHub Extension

List all installed GitHub CLI extensions

$gh extension list

Install an extension from a repository

$gh extension install <repo>

Install a specific extension by owner/repo name

$gh extension install <owner/repo>

Uninstall a specific GitHub CLI extension

$gh extension remove <name>

Update a specific extension to its latest version

$gh extension upgrade <name>

Update all installed extensions to their latest versions

$gh extension upgrade --all

Execute a local or uninstalled extension script

$gh extension exec <name>

Scaffold a new GitHub CLI extension project

$gh extension create <name>

Interactively browse and install available extensions

$gh extension browse

Search for available extensions on GitHub

$gh extension search <query>