LinuxCommandLibrary

hub-issue

Create GitHub issues from the command line

TLDR

List the last 10 issues with the bug label

$ hub issue list [[-L|--limit]] [10] [[-l|--labels]] "[bug]"
copy

Display a specific issue
$ hub issue show [issue_number]
copy

List 10 closed issues assigneed to a specific user
$ hub issue [[-s|--state]] [closed] [[-a|--assignee]] [username] --limit [10]
copy

SYNOPSIS


hub issue <subcommand> [options] [arguments]

Subcommands:
  hub issue list [options]
  hub issue show <ISSUE#>|
  hub issue create [options]

PARAMETERS

list
    Lists issues for the current repository. Accepts various filtering and sorting options.

list --state
    Filters issues by state. STATE can be 'open', 'closed', or 'all'.

list --assignee
    Filters issues by assignee username.

list --me
    Filters issues assigned to the current authenticated user.

list --labels
    Filters issues by comma-separated labels.

list --sort
    Sorts issues by 'created', 'updated', or 'comments'.

list --direction


    Sort order: 'asc' (ascending) or 'desc' (descending).

list --limit
    Limits the number of issues fetched.

list --json
    Outputs the list of issues in JSON format.

show |
    Shows details of a specific issue. ISSUE# is the issue number; URL is the full URL to the issue.

create
    Creates a new issue in the repository. Accepts options for title, body, labels, and assignment.

create --title
    Specifies the title of the new issue.

create --body
    Specifies the body/description of the new issue. If omitted, an editor will be opened.

create --edit
    Forces opening an editor for title and body, even if they are provided via flags.

create --labels
    Assigns comma-separated labels to the new issue.

create --assignee
    Assigns the issue to a specified user.

create --milestone
    Assigns the issue to a specified milestone (by name or number).

DESCRIPTION


The hub-issue command is a specialized subcommand of the hub tool, which extends Git's functionality to interact seamlessly with GitHub. It provides a powerful command-line interface for managing GitHub issues directly from your terminal, eliminating the need to navigate the web interface for common tasks. Users can list, show details of, and create new issues within their GitHub repositories. This integration allows developers to stay within their command-line workflow while interacting with critical project management aspects on GitHub. It's particularly useful for quick queries, adding issues on the fly, or incorporating issue tracking into scripts. For hub-issue to function, it requires a local Git repository with a remote configured to a GitHub repository, and proper authentication with GitHub via the hub setup.

CAVEATS


Requires the hub tool to be installed and properly configured with a GitHub personal access token for authentication. The command operates within a local Git repository that has a remote configured to a GitHub repository (typically 'origin'). Its functionality is a subset of the full GitHub web interface, primarily focused on listing, showing, and creating issues.

AUTHENTICATION


hub-issue relies on hub's authentication mechanism, which typically involves a GitHub personal access token. This token is usually stored in Git's configuration or environment variables, allowing hub to make authenticated requests to the GitHub API on your behalf.

REPOSITORY CONTEXT


The command infers the GitHub repository from your current Git project's remotes. It will typically use the 'origin' remote URL to determine the GitHub owner and repository name for issue operations.

USAGE EXAMPLES


To list all open issues:
hub issue list
To show issue #123:
hub issue show 123
To create a new issue:
hub issue create --title "Fix bug X" --body "Detailed description..." --labels "bug,critical"
To list issues assigned to you:
hub issue list --me

HISTORY


The hub project, including the hub-issue command, was created by Mislav Marohnić. It emerged as a solution to bridge the gap between local Git workflows and GitHub's online features, aiming to make command-line interaction with GitHub as natural as Git itself. Since its inception, hub has been an open-source project actively maintained by its community, continuously evolving to support new GitHub features and improve user experience.

SEE ALSO

hub(1), git(1), hub-pull-request(1)

Copied to clipboard