LinuxCommandLibrary

gh-issue

Manage GitHub issues from the command line

TLDR

Display a specific issue

$ gh issue view [issue_number]
copy

Display a specific issue in the default web browser
$ gh issue view [issue_number] [[-w|--web]]
copy

Create a new issue in the default web browser
$ gh issue create [[-w|--web]]
copy

List the last 10 issues with the bug label
$ gh issue list [[-L|--limit]] [10] [[-l|--label]] "[bug]"
copy

List closed issues made by a specific user
$ gh issue list [[-s|--state]] closed [[-A|--author]] [username]
copy

Display the status of issues relevant to the user, in a specific repository
$ gh issue status [[-R|--repo]] [owner]/[repository]
copy

Reopen a specific issue
$ gh issue reopen [issue_number]
copy

SYNOPSIS

gh issue <command> [flags]

PARAMETERS

create
    Creates a new issue. Common options include: --title <string> (issue title), --body <string> (issue body), --label <name> (add a label), --assignee <name> (assign an individual), --milestone <name> (associate with a milestone), --project <name> (add to a project).

list
    Lists issues in a repository. Common filters include: --state <string> (e.g., 'open', 'closed', 'all'), --assignee <name>, --author <name>, --label <name>, --milestone <name>, --search <query>, and --limit <int> (number of issues to fetch).

view <number | URL>
    Displays details of a specific issue. Use --web to open in a browser or --comments to show comments.

edit <number | URL>
    Edits an existing issue. Options for modification are similar to create, including --title, --body, --add-label, --remove-label, --add-assignee, --remove-assignee, --milestone, and --project.

close <number | URL>
    Closes an issue. An optional --reason <string> can be provided (e.g., 'completed', 'not planned').

reopen <number | URL>
    Reopens a closed issue.

search <query>
    Searches for issues across repositories matching a query. Supports filtering similar to list, including --state, --label, --assignee, --author, and --limit.

status
    Shows a summary of open issues, assigned issues, and pull requests in the current repository, relevant to the authenticated user.

develop <number | URL>
    Creates a development branch linked to an issue, streamlining the workflow for addressing issues with code.

--repo <owner/repo>
    A global flag for gh commands that specifies the GitHub repository to operate on, overriding the current directory's inferred repository.

--help
    Displays help information for the gh issue command or a specific subcommand.

DESCRIPTION

The gh issue command is a powerful subcommand of the GitHub CLI (gh) that enables users to interact with GitHub issues directly from their terminal.
It provides comprehensive functionalities to create, list, view, edit, close, reopen, and search issues across repositories. This streamlines issue management workflows for developers who prefer a command-line interface over a web browser.
To function, it requires prior authentication with GitHub via gh auth login and typically operates within the context of a Git repository, though a target repository can be specified using the --repo flag.

CAVEATS

The gh issue command is part of the GitHub CLI (gh) and requires it to be installed on your system. It also necessitates an active GitHub account and successful authentication via gh auth login. All operations require internet connectivity to communicate with GitHub's API.

INTERACTIVE PROMPTS

Many gh issue subcommands, particularly create and edit, offer intuitive interactive prompts if essential arguments or options are omitted. This guides users through the process and enhances usability.

CONTEXT AWARENESS

When executed within a cloned Git repository, gh issue automatically detects the current GitHub repository context. This eliminates the need to explicitly specify the repository for most commands, simplifying common workflows.

HISTORY

The GitHub CLI (gh), which includes the gh issue subcommand, was officially released by GitHub in 2020. Issue management was a fundamental feature from its inception, aiming to provide a seamless, native command-line experience for GitHub users, extending capabilities previously confined to the web interface or API. It continues to be actively developed and maintained by GitHub.

SEE ALSO

gh(1), gh-pr(1), gh-repo(1), git(1)

Copied to clipboard