gh-label
Manage GitHub issue and pull request labels
TLDR
List labels for the repository in the current directory
View labels for the repository in the current directory in the default web browser
Create a label with a specific name, description and color in hexadecimal format for the repository in the current directory
Delete a label for the repository in the current directory, prompting for confirmation
Update the name and description for a specific label for the repository in the current directory
Clone labels from a specific repository into the repository in the current directory
Display help for a subcommand
SYNOPSIS
gh label list [<owner>/<repo>] [flags]
gh label create [<owner>/<repo>] <name> [flags]
gh label edit [<owner>/<repo>] <name> [flags]
gh label delete [<owner>/<repo>] <name> [flags]
PARAMETERS
list
Lists all labels in the specified or current repository.
create
Creates a new label with the given name, color, and optional description.
edit
Modifies an existing label. You can change its name, color, or description.
delete
Deletes a label from the repository. This action is irreversible.
-R, --repo <owner>/<repo>
(Global Flag) Specifies the GitHub repository to operate on. If omitted, it defaults to the current directory's linked repository.
--color <string>
(For create/edit) Sets the color for the label. Can be a 6-digit hex code (e.g., #FF0000) or a standard color name (e.g., red, blue).
--description <string>
(For create/edit) Provides a descriptive text for the label.
--name <string>
(For edit) Specifies the new name for the label.
--search <string>
(For list) Filters labels by name, showing only those that contain the specified string.
--limit <int>
(For list) Sets the maximum number of labels to fetch. Defaults to 30.
--json <fields>
(For list) Outputs labels in JSON format, allowing selection of specific fields (e.g., name,color,description).
--web
(For list) Opens the labels page for the repository in your default web browser.
--force, --yes
(For create/edit/delete) Skips confirmation prompts, proceeding directly with the operation.
DESCRIPTION
gh-label is a subcommand of the official GitHub CLI (gh), designed for efficient management of repository labels directly from the command line. Labels are crucial for organizing and categorizing issues and pull requests on GitHub. This command empowers users to list, create, edit, and delete labels, providing a robust interface for maintaining consistent labeling practices across projects. It's particularly useful for scripting, automating repository setup, and streamlining workflows for developers and project managers who prefer to work within the terminal environment.
CAVEATS
Using gh-label requires the GitHub CLI (gh) to be installed and authenticated to your GitHub account. Ensure you have the necessary permissions (e.g., write access) on the target repository to create, edit, or delete labels. Label names are case-insensitive for identification but preserve their case upon creation.
DEFAULT REPOSITORY CONTEXT
If you execute gh label commands from within a local Git repository that is linked to a GitHub remote, the command will automatically operate on that repository unless a different one is specified using the --repo flag.
INTERACTIVE BEHAVIOR
When creating or editing labels, gh-label may prompt for missing required information (like color for creation) or confirmation for destructive actions (like deletion) if not provided via flags like --color or --yes.
HISTORY
The gh-label command is an integral part of the GitHub CLI, which was first announced in 2019 and reached general availability in 2020. As labels are fundamental to organizing work on GitHub, the ability to manage them via the command line was a core feature from the early development phases of the CLI, reflecting GitHub's commitment to empowering developers with powerful command-line tools for their workflows.