GitHub CLI commands

GitHub on the command line

740 commands

GitHub Repository

  • gh repo clone <repo>

    Clone a repository locally

  • gh repo clone <owner/repo>

    Clone a specific owner's repository locally

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

    Clone a repository into a specified directory

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

    Perform a shallow clone of a repository

  • gh repo create

    Create a new repository interactively

  • gh repo create <name>

    Create a new repository with the specified name

  • gh repo create --public

    Create a new public repository

  • gh repo create --private

    Create a new private repository

  • gh repo create --internal

    Create a new internal repository

  • gh repo create --source .

    Create a repository from the current local directory

  • gh repo create --push

    Create a repository and push local commits to it

  • gh repo create --remote <name>

    Create a repository and set a custom remote name

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

    Create a repository with a specific description

  • gh repo create --homepage <url>

    Create a repository with a specified homepage URL

  • gh repo create --team <name>

    Create a repository and grant access to a specific team

  • gh repo create --disable-issues

    Create a repository with issues disabled

  • gh repo create --disable-wiki

    Create a repository with the wiki disabled

  • gh repo create --include-all-branches

    Create a repository and push all local branches

  • gh repo create --template <repo>

    Create a new repository using an existing template

  • gh repo create --clone

    Create a repository and immediately clone it locally

  • gh repo create --gitignore <template>

    Create a repository with a specific gitignore template

  • gh repo create --license <license>

    Create a repository with a specific open source license

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

    Publish the current directory as a new public repository

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

    Create a private repository with a name and description

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

    Create a public repository and clone it locally

  • gh repo view

    View details of the current repository

  • gh repo view <owner/repo>

    View details of a specific repository

  • gh repo view --web

    Open the current repository in the web browser

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

    Open a specific repository in the web browser

  • gh repo view --json <fields>

    Output specific repository details in JSON format

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

    Output repository name, description, and URL in JSON

  • gh repo list

    List repositories owned by the authenticated user

  • gh repo list <owner>

    List repositories owned by a specific user or org

  • gh repo list --public

    List only public repositories

  • gh repo list --private

    List only private repositories

  • gh repo list --fork

    List only forked repositories

  • gh repo list --source

    List only non-forked (source) repositories

  • gh repo list --archived

    List only archived repositories

  • gh repo list --no-archived

    Exclude archived repositories from the list

  • gh repo list --language <language>

    List repositories filtered by primary language

  • gh repo list --topic <topic>

    List repositories filtered by a specific topic

  • gh repo list --limit <number>

    Limit the number of repositories listed

  • gh repo list --json <fields>

    Output repository list in JSON format with specific fields

  • gh repo fork

    Fork the current repository

  • gh repo fork <repo>

    Fork a specific repository

  • gh repo fork --clone

    Fork a repository and clone it locally

  • gh repo fork --remote

    Fork and add a remote for the fork

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

    Fork and set a custom remote name for the fork

  • gh repo fork --org <org>

    Fork a repository into a specific organization

  • gh repo fork --fork-name <name>

    Fork a repository and give the fork a new name

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

    Fork, clone locally, and set up remotes automatically

  • gh repo delete

    Delete the current repository interactively

  • gh repo delete <owner/repo>

    Delete a specific repository interactively

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

    Delete a repository bypassing the confirmation prompt

  • gh repo rename

    Rename the current repository interactively

  • gh repo rename <new-name>

    Rename the current repository to a new name

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

    Rename a specific repository to a new name

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

    Rename the repository bypassing the confirmation prompt

  • gh repo edit

    Edit repository settings interactively

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

    Update the repository's description

  • gh repo edit --homepage <url>

    Update the repository's homepage URL

  • gh repo edit --visibility public

    Change the repository visibility to public

  • gh repo edit --visibility private

    Change the repository visibility to private

  • gh repo edit --visibility internal

    Change the repository visibility to internal

  • gh repo edit --enable-issues

    Enable issues for the repository

  • gh repo edit --disable-issues

    Disable issues for the repository

  • gh repo edit --enable-wiki

    Enable the wiki for the repository

  • gh repo edit --disable-wiki

    Disable the wiki for the repository

  • gh repo edit --enable-discussions

    Enable discussions for the repository

  • gh repo edit --disable-discussions

    Disable discussions for the repository

  • gh repo edit --enable-projects

    Enable projects for the repository

  • gh repo edit --disable-projects

    Disable projects for the repository

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

    Add a topic to the repository

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

    Remove a topic from the repository

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

    Set the default branch for the repository

  • gh repo edit --allow-squash-merge

    Allow squash merging for pull requests

  • gh repo edit --allow-merge-commit

    Allow merge commits for pull requests

  • gh repo edit --allow-rebase-merge

    Allow rebase merging for pull requests

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

    Automatically delete head branches after PR merge

  • gh repo edit --template

    Mark the repository as a template repository

  • gh repo edit --enable-auto-merge

    Enable auto-merge functionality for PRs

  • gh repo archive

    Archive the current repository interactively

  • gh repo archive <owner/repo>

    Archive a specific repository interactively

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

    Archive a repository bypassing the confirmation prompt

  • gh repo unarchive

    Unarchive the current repository interactively

  • gh repo unarchive <owner/repo>

    Unarchive a specific repository interactively

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

    Unarchive a repository bypassing the confirmation prompt

  • gh repo sync

    Sync the local repository with its remote parent

  • gh repo sync <owner/repo>

    Sync a specific repository with its parent

  • gh repo sync --branch <branch>

    Sync a specific branch of the repository

  • gh repo sync --force

    Forcefully sync the repository, overwriting local changes

  • gh repo sync --source <repo>

    Sync the repository from a specific source repository

  • gh repo deploy-key list

    List deploy keys for the repository

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

    Add a new deploy key from a file

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

    Add a new deploy key with a specific title

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

    Add a deploy key with write access enabled

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

    Delete a deploy key by its ID

GitHub Pull Request

  • gh pr list

    List open pull requests for the current repository

  • gh pr list --state open

    List only open pull requests

  • gh pr list --state closed

    List only closed (unmerged) pull requests

  • gh pr list --state merged

    List only merged pull requests

  • gh pr list --state all

    List all pull requests regardless of state

  • gh pr list --author <username>

    List pull requests created by a specific user

  • gh pr list --assignee <username>

    List pull requests assigned to a specific user

  • gh pr list --label <label>

    List pull requests with a specific label

  • gh pr list --base <branch>

    List pull requests targeting a specific base branch

  • gh pr list --head <branch>

    List pull requests originating from a specific head branch

  • gh pr list --limit <number>

    Limit the number of pull requests displayed

  • gh pr list --search <query>

    List pull requests matching a search query

  • gh pr list --web

    Open the list of pull requests in the web browser

  • gh pr list --json <fields>

    Output pull request details in JSON format

  • gh pr list --template <template>

    Format the PR list output using a Go template

  • gh pr list --draft

    List only draft pull requests

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

    List pull requests for a specific repository

  • gh pr view

    View details of the pull request for the current branch

  • gh pr view <number>

    View details of a specific pull request by number

  • gh pr view <branch>

    View details of a pull request associated with a branch

  • gh pr view --web

    Open the current branch's PR in the web browser

  • gh pr view --web <number>

    Open a specific PR in the web browser

  • gh pr view --json <fields>

    Output specific details of a PR in JSON format

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

    Parse PR JSON output using a jq expression

  • gh pr view --comments

    View the current branch's PR along with its comments

  • gh pr view <number> --comments

    View a specific PR and its comments

  • gh pr create

    Create a new pull request interactively

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

    Create a pull request with a specific title

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

    Create a pull request with a specific description body

  • gh pr create --base <branch>

    Create a pull request targeting a specific base branch

  • gh pr create --head <branch>

    Create a pull request from a specific head branch

  • gh pr create --draft

    Create a pull request as a draft

  • gh pr create --web

    Continue creating the pull request in the web browser

  • gh pr create --fill

    Automatically fill PR title and body from commit info

  • gh pr create --fill-verbose

    Fill PR title/body using detailed commit messages

  • gh pr create --reviewer <username>

    Create a PR and request a review from a specific user

  • gh pr create --assignee <username>

    Create a PR and assign it to a specific user

  • gh pr create --label <label>

    Create a PR and attach a specific label

  • gh pr create --milestone <milestone>

    Create a PR and assign it to a milestone

  • gh pr create --project <project>

    Create a PR and add it to a project board

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

    Create a PR in a different repository

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

    Create a PR from a specific branch targeting main

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

    Create a titled PR from a specific branch to main

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

    Create a fully populated PR from a specific branch to main

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

    Create a fully populated draft PR to main

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

    Create a PR with details and request a reviewer

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

    Create a PR with details and assign a label

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

    Create a PR with details and assign a user

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

    Create a PR with all details, reviewers, and assignees

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

    Create a PR reading the body text from a file

  • gh pr create --fill --draft

    Quickly create a draft PR using commit info

  • gh pr merge

    Merge the pull request for the current branch interactively

  • gh pr merge <number>

    Merge a specific pull request interactively

  • gh pr merge --merge

    Merge the PR using a standard merge commit

  • gh pr merge --squash

    Merge the PR by squashing commits

  • gh pr merge --rebase

    Merge the PR by rebasing commits

  • gh pr merge --delete-branch

    Merge the PR and delete the local and remote branch

  • gh pr merge --auto

    Enable auto-merge to trigger when requirements are met

  • gh pr merge --disable-auto

    Disable previously set auto-merge for the PR

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

    Squash merge a specific PR and delete its branch

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

    Create a merge commit for a PR and delete its branch

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

    Rebase merge a specific PR and delete its branch

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

    Squash merge with a custom commit title and body

  • gh pr merge --admin

    Merge a PR using administrator privileges to bypass rules

  • gh pr close

    Close the pull request for the current branch

  • gh pr close <number>

    Close a specific pull request without merging

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

    Close a PR and leave a closing comment

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

    Close a PR and delete its associated branch

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

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

  • gh pr reopen

    Reopen a previously closed pull request for the current branch

  • gh pr reopen <number>

    Reopen a specific closed pull request

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

    Reopen a pull request and add a comment

  • gh pr checkout

    Checkout the pull request for the current branch

  • gh pr checkout <number>

    Checkout a specific pull request branch locally

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

    Checkout a PR into a specific new local branch name

  • gh pr checkout <number> --force

    Force checkout a PR, overwriting local changes

  • gh pr checkout <number> --detach

    Checkout a PR in a detached HEAD state

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

    Checkout a PR and update its submodules

  • gh pr diff

    View the diff of the PR for the current branch

  • gh pr diff <number>

    View the code diff for a specific pull request

  • gh pr diff --patch

    Output the PR diff in patch format

  • gh pr diff --name-only

    List only the names of files changed in the PR

  • gh pr diff --color always

    Force colored output for the PR diff

  • gh pr diff --color never

    Disable colored output for the PR diff

  • gh pr diff <number> --patch

    Get the diff of a specific PR in patch format

  • gh pr edit

    Edit details of the current branch's PR interactively

  • gh pr edit <number>

    Edit a specific pull request interactively

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

    Change the title of the pull request

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

    Update the description body of the pull request

  • gh pr edit --base <branch>

    Change the base branch the pull request is targeting

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

    Request a review from a specific user on the PR

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

    Remove a review request for a specific user

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

    Assign the pull request to a specific user

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

    Unassign a specific user from the pull request

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

    Add a label to the pull request

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

    Remove a label from the pull request

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

    Add the pull request to a specific project

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

    Remove the pull request from a project

  • gh pr edit --milestone <milestone>

    Set the milestone for the pull request

  • gh pr edit --ready

    Mark a draft pull request as ready for review

  • gh pr edit --draft

    Convert a standard pull request back to a draft

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

    Edit the title and body of a specific PR

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

    Add a label and reviewer to a specific PR

  • gh pr review

    Add a review to the pull request for the current branch

  • gh pr review <number>

    Add a review to a specific pull request

  • gh pr review --approve

    Approve the pull request

  • gh pr review --request-changes

    Request changes on the pull request

  • gh pr review --comment

    Submit a general comment review on the pull request

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

    Submit a review with specific body text

  • gh pr review <number> --approve

    Approve a specific pull request

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

    Request changes on a specific PR with an explanation

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

    Leave a review comment on a specific PR

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

    Approve a specific PR and leave a comment

  • gh pr checks

    Show CI status for the current branch's PR

  • gh pr checks <number>

    Show CI status for a specific PR

  • gh pr checks --watch

    Watch PR checks and wait until they complete

  • gh pr checks --fail-fast

    Exit the watch process immediately if any check fails

  • gh pr checks --required

    Show status only for required checks

  • gh pr checks --interval <seconds>

    Set the refresh interval when watching checks

  • gh pr checks <number> --watch

    Watch the CI checks for a specific PR

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

    Watch checks for a PR and exit quickly on failure

  • gh pr comment

    Add a comment to the current branch's PR

  • gh pr comment <number>

    Add a comment to a specific PR interactively

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

    Add a specific comment to the current PR

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

    Add a specific comment text to a specific PR

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

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

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

    Edit your last comment on a specific PR

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

    Delete your last comment on a specific PR

  • gh pr comment <number> --web

    Open a specific PR in the browser to leave a comment

  • gh pr ready

    Mark the current draft PR as ready for review

  • gh pr ready <number>

    Mark a specific draft PR as ready for review

  • gh pr ready <number> --undo

    Convert a specific PR back to draft status

  • gh pr lock

    Lock conversation on the current branch's PR

  • gh pr lock <number>

    Lock conversation on a specific PR

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

    Lock a PR conversation as off-topic

  • gh pr lock <number> --reason resolved

    Lock a PR conversation because it is resolved

  • gh pr lock <number> --reason spam

    Lock a PR conversation due to spam

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

    Lock a PR conversation because it is too heated

  • gh pr unlock

    Unlock conversation on the current branch's PR

  • gh pr unlock <number>

    Unlock conversation on a specific PR

  • gh project list

    List all projects for the current repository or organization

  • gh project list --owner <owner>

    List projects for a specific user or organization

  • gh project list --format json

    List projects and output the result in JSON format

  • gh project view <number>

    View details of a specific project by number

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

    View a project owned by a specific user or organization

  • gh project view <number> --format json

    View details of a specific project in JSON format

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

    Create a new project for a specific owner with a title

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

    Rename or edit the title of an existing project

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

    Delete a specific project permanently

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

    Duplicate a project to a new owner with a new title

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

    Close a specific project without deleting it

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

    Link a project to a specific repository

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

    Remove a repository link from a project

  • gh project item-list <number>

    List all items (issues/PRs) within a project

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

    List items in a specific owner's project

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

    Add an issue or PR to a project using its URL

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

    Delete a specific item from a project

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

    Edit a specific field value for an item in a project

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

    Archive an item within a project

  • gh project field-list <number>

    List all custom fields defined in a project

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

    List fields for a specific owner's project

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

    Create a new text field in a project

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

    Delete a custom field from a project

  • gh project column-list <number>

    List all columns (for classic projects)

GitHub Issue

  • gh issue list

    List open issues for the current repository

  • gh issue list --state open

    List only open issues

  • gh issue list --state closed

    List only closed issues

  • gh issue list --state all

    List all issues regardless of open/closed state

  • gh issue list --author <username>

    List issues created by a specific user

  • gh issue list --assignee <username>

    List issues assigned to a specific user

  • gh issue list --label <label>

    List issues that have a specific label attached

  • gh issue list --milestone <milestone>

    List issues assigned to a specific milestone

  • gh issue list --limit <number>

    Limit the maximum number of issues displayed

  • gh issue list --search <query>

    Search for issues matching a specific text query

  • gh issue list --web

    Open the issue list in the web browser

  • gh issue list --json <fields>

    Output issue details in JSON format

  • gh issue list --template <template>

    Format the issue list using a custom Go template

  • gh issue list --mention <username>

    List issues where a specific user is mentioned

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

    List issues for a specific repository

  • gh issue view

    View details of an issue interactively

  • gh issue view <number>

    View details of a specific issue by number

  • gh issue view --web

    Open the current issue in the web browser

  • gh issue view <number> --web

    Open a specific issue in the web browser

  • gh issue view --json <fields>

    Output specific details of an issue in JSON format

  • gh issue view --comments

    View an issue along with its comments

  • gh issue view <number> --comments

    View a specific issue and all of its comments

  • gh issue create

    Create a new issue interactively

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

    Create a new issue with a specific title

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

    Create a new issue with a specific description body

  • gh issue create --assignee <username>

    Create a new issue and assign it to a user

  • gh issue create --label <label>

    Create a new issue and add a label to it

  • gh issue create --milestone <milestone>

    Create a new issue and assign it to a milestone

  • gh issue create --project <project>

    Create a new issue and add it to a project

  • gh issue create --web

    Continue creating an issue in the web browser

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

    Create an issue in a different repository

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

    Create an issue instantly with a title and body

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

    Create an issue with a title, body, and label

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

    Create an issue with a title, body, and assignee

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

    Create a fully populated issue with labels and assignee

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

    Create an issue reading the body content from a file

  • gh issue close

    Close an issue interactively

  • gh issue close <number>

    Close a specific issue by number

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

    Close an issue and leave a closing comment

  • gh issue close <number> --reason completed

    Close an issue marking it as successfully completed

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

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

  • gh issue reopen

    Reopen a closed issue interactively

  • gh issue reopen <number>

    Reopen a specific closed issue

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

    Reopen an issue and add a comment

  • gh issue edit

    Edit an issue interactively

  • gh issue edit <number>

    Edit a specific issue interactively

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

    Change the title of an issue

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

    Change the description body of an issue

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

    Assign a user to an existing issue

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

    Unassign a user from an existing issue

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

    Add a new label to an existing issue

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

    Remove a label from an existing issue

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

    Add an existing issue to a project

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

    Remove an issue from a project

  • gh issue edit --milestone <milestone>

    Set or change the milestone for an issue

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

    Update both the title and body of a specific issue

  • gh issue comment

    Add a comment to an issue interactively

  • gh issue comment <number>

    Add a comment to a specific issue interactively

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

    Submit a comment using the provided text body

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

    Add a specific text comment to a specific issue

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

    Comment on an issue using the contents of a file

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

    Edit your most recent comment on an issue

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

    Delete your most recent comment on an issue

  • gh issue comment <number> --web

    Open an issue in the browser to leave a comment

  • gh issue delete

    Delete an issue permanently interactively

  • gh issue delete <number>

    Delete a specific issue permanently

  • gh issue delete <number> --yes

    Delete an issue bypassing the confirmation prompt

  • gh issue develop

    Create a branch for an issue interactively

  • gh issue develop <number>

    Create a linked branch for a specific issue

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

    Create a branch for an issue with a specific name

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

    Create a branch for an issue originating from a specific base

  • gh issue develop <number> --checkout

    Create a branch for an issue and check it out locally

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

    Create a named branch for an issue and check it out

  • gh issue lock

    Lock conversation on an issue interactively

  • gh issue lock <number>

    Lock conversation on a specific issue

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

    Lock an issue conversation marking it off-topic

  • gh issue lock <number> --reason resolved

    Lock an issue conversation marking it resolved

  • gh issue lock <number> --reason spam

    Lock an issue conversation marking it as spam

  • gh issue unlock

    Unlock conversation on an issue interactively

  • gh issue unlock <number>

    Unlock conversation on a specific issue

  • gh issue pin

    Pin an issue to the repository's issue list

  • gh issue pin <number>

    Pin a specific issue by number

  • gh issue unpin

    Unpin an issue from the repository's issue list

  • gh issue unpin <number>

    Unpin a specific issue by number

  • gh issue transfer

    Transfer an issue to another repository interactively

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

    Transfer a specific issue to a destination repository

GitHub Workflow & Run

  • gh workflow list

    List GitHub Actions workflows in the current repository

  • gh workflow list --all

    List all workflows, including disabled ones

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

    List workflows for a specific repository

  • gh workflow list --json <fields>

    Output workflow details in JSON format

  • gh workflow view

    View details of a workflow interactively

  • gh workflow view <workflow>

    View details of a specific workflow

  • gh workflow view --web

    Open a workflow in the web browser

  • gh workflow view <workflow> --web

    Open a specific workflow in the web browser

  • gh workflow view --yaml

    View the YAML configuration of a workflow

  • gh workflow view <workflow> --yaml

    View the YAML file of a specific workflow

  • gh workflow view --ref <branch>

    View a workflow file as it exists on a specific branch

  • gh workflow enable

    Enable a disabled workflow interactively

  • gh workflow enable <workflow>

    Enable a specific disabled workflow

  • gh workflow disable

    Disable an active workflow interactively

  • gh workflow disable <workflow>

    Disable a specific active workflow

  • gh workflow run

    Run a workflow manually interactively

  • gh workflow run <workflow>

    Trigger a specific workflow manually

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

    Trigger a workflow to run on a specific branch

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

    Run a workflow passing a specific input parameter

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

    Run a workflow passing raw string input parameters

  • gh workflow run <workflow> --json

    Run a workflow and accept inputs from a JSON string

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

    Run a workflow on a branch with specific inputs

  • gh run list

    List recent workflow runs for the repository

  • gh run list --workflow <workflow>

    List runs for a specific workflow

  • gh run list --branch <branch>

    List workflow runs executed on a specific branch

  • gh run list --user <username>

    List workflow runs triggered by a specific user

  • gh run list --status <status>

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

  • gh run list --event <event>

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

  • gh run list --commit <sha>

    List workflow runs associated with a specific commit

  • gh run list --limit <number>

    Limit the number of workflow runs returned

  • gh run list --json <fields>

    Output workflow runs data in JSON format

  • gh run list --created <date>

    List workflow runs created on or after a specific date

  • gh run view

    View details of a workflow run interactively

  • gh run view <run-id>

    View details of a specific workflow run

  • gh run view --web

    Open a workflow run in the web browser

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

    Open a specific workflow run in the web browser

  • gh run view --log

    View the complete log output of a workflow run

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

    View the logs for a specific workflow run

  • gh run view --log-failed

    View only the failed log steps of a workflow run

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

    View failed logs for a specific workflow run

  • gh run view --exit-status

    Exit with a non-zero status if the run failed

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

    Check the exit status of a specific workflow run programmatically

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

    View details for a specific job within a run

  • gh run view --verbose

    View detailed information about a run's steps

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

    View verbose details for a specific workflow run

  • gh run watch

    Watch a workflow run's progress interactively

  • gh run watch <run-id>

    Watch the progress of a specific workflow run

  • gh run watch --exit-status

    Watch a run and exit with its final status code

  • gh run watch --interval <seconds>

    Set the polling interval while watching a run

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

    Watch a specific run and return its exit code upon completion

  • gh run rerun

    Re-run a workflow run interactively

  • gh run rerun <run-id>

    Re-run a specific workflow run completely

  • gh run rerun --failed-only

    Re-run only the failed jobs in a workflow run

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

    Re-run failed jobs for a specific workflow run

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

    Re-run a specific job within a workflow run

  • gh run rerun --debug

    Re-run a workflow run with runner debug logging enabled

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

    Re-run a specific run with debug logging

  • gh run cancel

    Cancel a workflow run interactively

  • gh run cancel <run-id>

    Cancel a specific in-progress workflow run

  • gh run delete

    Delete a workflow run interactively

  • gh run delete <run-id>

    Delete a specific workflow run permanently

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

    Delete a workflow run bypassing the confirmation prompt

  • gh run download

    Download artifacts from a workflow run interactively

  • gh run download <run-id>

    Download all artifacts generated by a specific run

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

    Download a specific named artifact from a run

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

    Download a run's artifacts into a specific directory

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

    Download artifacts matching a glob pattern from a run

GitHub Auth & Config

  • gh auth login

    Log in to a GitHub account interactively

  • gh auth login --web

    Log in to GitHub via the web browser

  • gh auth login --with-token

    Log in using a personal access token provided via standard input

  • gh auth login --hostname <hostname>

    Log in to a specific GitHub Enterprise Server instance

  • gh auth login --scopes <scopes>

    Log in and request specific additional OAuth scopes

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

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

  • gh auth logout

    Log out of your GitHub account

  • gh auth logout --hostname <hostname>

    Log out from a specific GitHub Enterprise Server

  • gh auth status

    Check your current authentication status

  • gh auth status --hostname <hostname>

    Check auth status for a specific enterprise host

  • gh auth status --show-token

    Display the active authentication token in the status output

  • gh auth token

    Print the current authentication token to standard output

  • gh auth token --hostname <hostname>

    Print the token for a specific enterprise host

  • gh auth refresh

    Refresh the current authentication session

  • gh auth refresh --scopes <scopes>

    Refresh auth session to request additional scopes

  • gh auth refresh --hostname <hostname>

    Refresh auth session for a specific enterprise host

  • gh auth setup-git

    Configure Git to use GitHub CLI as a credential helper

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

    Configure Git credential helper for a specific host

  • gh config list

    List all configured settings for the GitHub CLI

  • gh config get <key>

    Retrieve the value of a specific configuration key

  • gh config set <key> <value>

    Set a specific configuration key to a given value

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

    Set a configuration key for a specific host

  • gh config set editor <editor>

    Set the default text editor for the GitHub CLI

  • gh config set browser <browser>

    Set the default web browser for the GitHub CLI

  • gh config set git_protocol https

    Set HTTPS as the default Git protocol

  • gh config set git_protocol ssh

    Set SSH as the default Git protocol

  • gh config set prompt enabled

    Enable interactive prompts for the CLI

  • gh config set prompt disabled

    Disable interactive prompts for scripting

  • gh config set pager <pager>

    Set a custom terminal pager for long outputs

GitHub Gist & Release

  • gh release list

    List releases for the current repository

  • gh release list --limit <number>

    Limit the number of releases shown

  • gh release list --exclude-drafts

    List releases but hide drafts

  • gh release list --exclude-pre-releases

    List releases but hide pre-releases

  • gh release list --json <fields>

    Output release list in JSON format

  • gh release view

    View details of the latest release

  • gh release view <tag>

    View details of a release by its tag name

  • gh release view --web

    Open the latest release in the web browser

  • gh release view <tag> --web

    Open a specific release in the web browser

  • gh release view --json <fields>

    Output release details in JSON format

  • gh release create

    Create a new release interactively

  • gh release create <tag>

    Create a release for a specific tag

  • gh release create <tag> <files>

    Create a release and upload assets to it

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

    Create a release with a custom title

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

    Create a release with specific release notes

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

    Create a release using release notes from a file

  • gh release create <tag> --draft

    Create a release but save it as a draft

  • gh release create <tag> --prerelease

    Create a release and mark it as a pre-release

  • gh release create <tag> --latest

    Create a release and explicitly mark it as the latest

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

    Create a release targeting a specific branch or commit

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

    Create a release and auto-generate notes based on PRs

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

    Generate notes starting from a previous specific tag

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

    Create a release and start a discussion in a specific category

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

    Create a complete release with assets, title, and notes

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

    Create a release with assets and auto-generated notes

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

    Create a draft pre-release

  • gh release edit

    Edit the latest release interactively

  • gh release edit <tag>

    Edit a specific release by tag interactively

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

    Update the title of an existing release

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

    Update the release notes of an existing release

  • gh release edit <tag> --draft

    Convert a published release to a draft

  • gh release edit <tag> --prerelease

    Convert a published release to a pre-release

  • gh release edit <tag> --latest

    Set an existing release as the latest release

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

    Publish a release that is currently a draft

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

    Change the tag associated with an existing release

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

    Change the target commitish for an existing release

  • gh release delete

    Delete a release interactively

  • gh release delete <tag>

    Delete a specific release by its tag

  • gh release delete <tag> --yes

    Delete a release bypassing the confirmation prompt

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

    Delete a release and its associated git tag

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

    Force delete a release and its git tag simultaneously

  • gh release download

    Download assets from the latest release

  • gh release download

    Download assets from the latest release

  • gh release download <tag>

    Download assets from a specific tagged release

  • gh release download --pattern <glob>

    Download latest release assets matching a glob pattern

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

    Download specific release assets matching a pattern

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

    Download release assets into a specific directory

  • gh release download <tag> --archive zip

    Download the release source code as a ZIP archive

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

    Download the release source code as a tarball

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

    Download matching assets from a release to a specific folder

  • gh release download --clobber <tag>

    Download assets and overwrite existing files locally

  • gh release upload

    Upload assets to a release interactively

  • gh release upload <tag> <files>

    Upload one or more files to a specific release

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

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

  • gh gist list

    List your GitHub gists

  • gh gist list --limit <number>

    Limit the number of gists displayed

  • gh gist list --public

    List only your public gists

  • gh gist list --secret

    List only your secret gists

  • gh gist view <gist-id>

    View the content of a specific gist

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

    Open a specific gist in the web browser

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

    Output the raw content of a gist without formatting

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

    View a specific file from a multi-file gist

  • gh gist create

    Create a new gist interactively

  • gh gist create <file>

    Create a new gist from a local file

  • gh gist create <file1> <file2>

    Create a multi-file gist from local files

  • gh gist create --public

    Create a public gist (default is secret)

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

    Create a gist with a specific description

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

    Create a described, public gist from a file

  • gh gist create -

    Create a gist by reading content from standard input

  • gh gist edit <gist-id>

    Edit an existing gist interactively

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

    Edit a specific file within an existing gist

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

    Add a new file to an existing gist

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

    Remove a file from an existing gist

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

    Update the description of an existing gist

  • gh gist delete <gist-id>

    Delete a gist permanently interactively

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

    Delete a gist bypassing the confirmation prompt

  • gh gist clone <gist-id>

    Clone a gist locally as a git repository

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

    Clone a gist into a specified directory

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

    Rename a file within an existing gist

GitHub Secret & Variable

  • gh secret list

    List GitHub Actions secrets for the current repository

  • gh secret list --org <org>

    List secrets for a specific organization

  • gh secret list --env <environment>

    List secrets for a specific deployment environment

  • gh secret list --user

    List your personal Codespaces secrets

  • gh secret list --json <fields>

    Output secrets list in JSON format

  • gh secret set <name>

    Create or update a secret interactively

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

    Set a secret with a specific string value

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

    Set a secret reading the value from a file

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

    Create an organization-level secret

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

    Create an org secret visible to all repositories

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

    Create an org secret visible only to private repositories

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

    Create an org secret visible to specific repositories

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

    Create an org secret and assign it to specific repos

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

    Create an environment-specific secret

  • gh secret set <name> --user

    Create a personal Codespaces secret

  • gh secret delete <name>

    Delete a repository secret

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

    Delete an organization secret

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

    Delete an environment secret

  • gh secret delete <name> --user

    Delete a personal Codespaces secret

  • gh variable list

    List GitHub Actions variables for the repository

  • gh variable list --org <org>

    List variables for an organization

  • gh variable list --env <environment>

    List variables for a specific environment

  • gh variable list --json <fields>

    Output variables list in JSON format

  • gh variable set <name>

    Create or update a variable interactively

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

    Set a variable with a specific string value

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

    Create an organization-level variable

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

    Create an org variable visible to all repositories

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

    Create an org variable visible to selected repositories

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

    Create an org variable and specify access for repos

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

    Create an environment-specific variable

  • gh variable delete <name>

    Delete a repository variable

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

    Delete an organization variable

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

    Delete an environment variable

GitHub Label & Milestone

  • gh label list

    List all labels in the current repository

  • gh label list --json <fields>

    Output label data in JSON format

  • gh label list --search <query>

    Search for specific labels by name or description

  • gh label list --order asc

    Sort the label list in ascending order

  • gh label list --order desc

    Sort the label list in descending order

  • gh label list --sort created

    Sort labels by their creation date

  • gh label list --sort name

    Sort labels alphabetically by name

  • gh label create <name>

    Create a new label with a random color

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

    Create a new label with a specific hex color

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

    Create a new label with a description

  • gh label create <name> --force

    Update an existing label if it already exists

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

    Create a fully specified label with color and description

  • gh label edit <name>

    Edit an existing label interactively

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

    Rename an existing label

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

    Change the hex color of an existing label

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

    Update the description of an existing label

  • gh label delete <name>

    Delete a label interactively

  • gh label delete <name> --yes

    Delete a label bypassing the confirmation prompt

  • gh label clone <source-repo>

    Copy labels from a different repository into the current one

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

    Copy labels, overwriting matching existing labels

GitHub Search

  • gh search repos <query>

    Search for repositories across GitHub

  • gh search repos <query> --limit <number>

    Limit the number of repository search results

  • gh search repos <query> --language <language>

    Search repositories written in a specific language

  • gh search repos <query> --stars >1000

    Search for repositories with more than 1000 stars

  • gh search repos <query> --owner <owner>

    Search repositories owned by a specific user or org

  • gh search repos <query> --topic <topic>

    Search repositories tagged with a specific topic

  • gh search repos <query> --visibility public

    Search only public repositories

  • gh search repos <query> --json <fields>

    Output repository search results in JSON format

  • gh search repos <query> --sort stars

    Sort repository search results by star count

  • gh search repos <query> --order desc

    Display repository search results in descending order

  • gh search repos <query> --web

    Open the repository search query in the browser

  • gh search prs <query>

    Search for pull requests globally

  • gh search prs <query> --limit <number>

    Limit the number of PR search results

  • gh search prs <query> --state open

    Search only for open pull requests

  • gh search prs <query> --state closed

    Search only for closed pull requests

  • gh search prs <query> --author <username>

    Search PRs created by a specific user

  • gh search prs <query> --repo <owner/repo>

    Search PRs within a specific repository

  • gh search prs <query> --label <label>

    Search PRs containing a specific label

  • gh search prs <query> --merged

    Search only for merged pull requests

  • gh search prs <query> --draft

    Search only for draft pull requests

  • gh search prs <query> --sort updated

    Sort PR search results by last updated time

  • gh search prs <query> --json <fields>

    Output PR search results in JSON format

  • gh search issues <query>

    Search for issues globally

  • gh search issues <query> --limit <number>

    Limit the number of issue search results

  • gh search issues <query> --state open

    Search only for open issues

  • gh search issues <query> --state closed

    Search only for closed issues

  • gh search issues <query> --author <username>

    Search issues created by a specific user

  • gh search issues <query> --repo <owner/repo>

    Search issues within a specific repository

  • gh search issues <query> --label <label>

    Search issues that have a specific label

  • gh search issues <query> --assignee <username>

    Search issues assigned to a specific user

  • gh search issues <query> --sort updated

    Sort issue search results by most recently updated

  • gh search issues <query> --json <fields>

    Output issue search results in JSON format

  • gh search commits <query>

    Search for commits matching a query

  • gh search commits <query> --author <username>

    Search commits authored by a specific user

  • gh search commits <query> --repo <owner/repo>

    Search commits within a specific repository

  • gh search commits <query> --author-date <date>

    Search commits authored on a specific date

  • gh search commits <query> --committer-date <date>

    Search commits committed on a specific date

  • gh search commits <query> --limit <number>

    Limit the number of commit search results

  • gh search commits <query> --json <fields>

    Output commit search results in JSON format

  • gh search code <query>

    Search for code snippets globally

  • gh search code <query> --repo <owner/repo>

    Search code within a specific repository

  • gh search code <query> --language <language>

    Search code written in a specific language

  • gh search code <query> --filename <filename>

    Search code matching a specific filename

  • gh search code <query> --extension <ext>

    Search code matching a specific file extension

  • gh search code <query> --owner <owner>

    Search code within a specific user's or org's repositories

  • gh search code <query> --limit <number>

    Limit the number of code search results

  • gh search code <query> --json <fields>

    Output code search results in JSON format

  • gh search code <query> --web

    Open the code search results in the browser

GitHub API & Alias

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

    Fetch milestones using the GitHub REST API

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

    Create a new milestone via a POST API request

  • gh api <endpoint>

    Make a custom GET request to a GitHub API endpoint

  • gh api <endpoint> --method GET

    Make an explicit GET request to an API endpoint

  • gh api <endpoint> --method POST

    Make a POST request to an API endpoint

  • gh api <endpoint> --method PUT

    Make a PUT request to an API endpoint

  • gh api <endpoint> --method PATCH

    Make a PATCH request to an API endpoint

  • gh api <endpoint> --method DELETE

    Make a DELETE request to an API endpoint

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

    Send a parameter payload with the API request

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

    Send a raw string parameter payload with the API request

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

    Send a custom HTTP header with the API request

  • gh api <endpoint> --paginate

    Automatically fetch all pages for a paginated API endpoint

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

    Filter the JSON response using a jq expression

  • gh api <endpoint> --template <template>

    Format the API response using a Go template

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

    Send a request body read from a local file

  • gh api <endpoint> --hostname <hostname>

    Make an API request to a specific GitHub Enterprise server

  • gh api <endpoint> --include

    Include HTTP response headers in the output

  • gh api <endpoint> --silent

    Suppress the response body output

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

    Cache the API response for a specified duration

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

    Make a GitHub GraphQL API query

  • gh api /user

    Fetch details of the currently authenticated user

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

    Fetch raw details of a specific repository via API

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

    Fetch raw issues data for a repository via API

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

    Fetch raw pull requests data for a repository via API

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

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

  • gh alias list

    List all configured custom aliases for the GitHub CLI

  • gh alias set <name> <expansion>

    Create a new alias that expands to a specific gh command

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

    Create an alias that executes a shell command

  • gh alias delete <name>

    Delete a previously configured CLI alias

  • gh alias import <file>

    Import aliases from a YAML configuration file

  • gh alias import --clobber <file>

    Import aliases from a file, overwriting existing ones

GitHub Codespace

  • gh codespace list

    List your active GitHub Codespaces

  • gh codespace view

    View details of an active Codespace interactively

  • gh codespace view --codespace <name>

    View details of a specific Codespace

  • gh codespace create

    Create a new Codespace interactively

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

    Create a Codespace for a specific repository

  • gh codespace create --branch <branch>

    Create a Codespace for a specific branch

  • gh codespace create --machine <type>

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

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

    Create a Codespace using a specific devcontainer.json configuration

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

    Create a Codespace for a specific branch of a specific repository

  • gh codespace delete

    Delete a Codespace interactively

  • gh codespace delete --codespace <name>

    Delete a specific Codespace by name

  • gh codespace delete --all

    Delete all of your active Codespaces

  • gh codespace delete --days <n>

    Delete Codespaces that have been inactive for N days

  • gh codespace ssh

    Open an interactive SSH session into a Codespace

  • gh codespace ssh --codespace <name>

    SSH into a specific named Codespace

  • gh codespace ssh -- <command>

    Run a specific command over SSH within a Codespace

  • gh codespace stop

    Stop a running Codespace interactively

  • gh codespace stop --codespace <name>

    Stop a specific running Codespace

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

    Change the friendly display name of a Codespace

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

    Change the machine type (hardware) of an existing Codespace

  • gh codespace ports

    List forwarded ports for an active Codespace

  • gh codespace ports --codespace <name>

    List ports for a specific active Codespace

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

    Forward a local port to a remote port on the Codespace

  • gh codespace ports visibility <port>:public

    Change the visibility of a Codespace port to public

  • gh codespace logs

    Tail the logs of a Codespace interactively

  • gh codespace logs --codespace <name>

    Tail logs for a specific Codespace

  • gh codespace cp <source> <dest>

    Copy a file between your local machine and a Codespace

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

    Recursively copy a directory to/from a Codespace

  • gh codespace rebuild

    Rebuild the dev container for a Codespace

  • gh codespace rebuild --full

    Perform a full rebuild of a Codespace ignoring cache

  • gh codespace code

    Open a Codespace in Visual Studio Code interactively

  • gh codespace code --codespace <name>

    Open a specific Codespace in Visual Studio Code

GitHub Cache & Organization

  • gh cache list

    List GitHub Actions caches for the repository

  • gh cache list --key <key>

    List caches matching a specific key

  • gh cache list --ref <ref>

    List caches associated with a specific branch/ref

  • gh cache list --limit <number>

    Limit the number of cache entries returned

  • gh cache list --json <fields>

    Output cache data in JSON format

  • gh cache delete <id>

    Delete a specific Actions cache by its ID

  • gh cache delete --all

    Delete all GitHub Actions caches for the repository

  • gh org list

    List organizations you belong to

  • gh org list --limit <number>

    Limit the number of organizations listed

  • gh org list --json <fields>

    Output your organization list in JSON format

GitHub Browse & Status

  • gh status

    View status of relevant PRs, issues, and workflow runs

  • gh status --exclude <owner/repo>

    View dashboard status excluding a specific repository

  • gh status --org <org>

    View dashboard status scoped to a specific organization

  • gh browse

    Open the current repository in the web browser

  • gh browse <number>

    Open a specific issue or PR number in the browser

  • gh browse <file>

    Open a specific repository file in the web browser

  • gh browse --branch <branch>

    Open a specific branch of the repository in the browser

  • gh browse --tag <tag>

    Open a specific tag of the repository in the browser

  • gh browse --commit <commit>

    Open a specific commit URL in the browser

  • gh browse --projects

    Open the repository's projects board in the browser

  • gh browse --wiki

    Open the repository's wiki page in the browser

  • gh browse --repo <owner/repo>

    Open a different specific repository in the browser

  • gh browse --no-browser

    Print the URL to the console instead of opening the browser

  • gh browse --settings

    Open the repository settings page in the browser

  • gh browse <file> --branch <branch>

    Open a specific file on a specific branch in the browser

GitHub Attestation

  • gh attestation verify <file>

    Verify the artifact attestation of a local file

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

    Verify an artifact file against a specific repository

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

    Verify an artifact file against a specific owner

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

    Verify an artifact using an explicit sigstore bundle

  • gh attestation download <subject-digest>

    Download an attestation bundle by subject digest

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

    Download an attestation bundle from a specific repo

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

    Download an attestation bundle matching a specific predicate type

GitHub Ruleset & Environment

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

    Fetch all configured deployment environments via API

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

    Fetch details of a specific deployment environment

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

    Create or update a deployment environment via API

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

    Delete a deployment environment via API

  • gh ruleset list

    List rulesets active on the current repository

  • gh ruleset list --org <org>

    List rulesets configured for a specific organization

  • gh ruleset list --parents

    List rulesets including those inherited from parents

  • gh ruleset view <id>

    View details of a specific repository ruleset

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

    View details of a specific organization ruleset

  • gh ruleset view <id> --web

    Open a specific ruleset in the web browser

  • gh ruleset check <branch>

    Evaluate which rulesets apply to a specific branch

  • gh ruleset check <branch> --default

    Check rules applied to the default branch

GitHub Extension

  • gh extension list

    List all installed GitHub CLI extensions

  • gh extension install <repo>

    Install an extension from a repository

  • gh extension install <owner/repo>

    Install a specific extension by owner/repo name

  • gh extension remove <name>

    Uninstall a specific GitHub CLI extension

  • gh extension upgrade <name>

    Update a specific extension to its latest version

  • gh extension upgrade --all

    Update all installed extensions to their latest versions

  • gh extension exec <name>

    Execute a local or uninstalled extension script

  • gh extension create <name>

    Scaffold a new GitHub CLI extension project

  • gh extension browse

    Interactively browse and install available extensions

  • gh extension search <query>

    Search for available extensions on GitHub