Skip to content

GitHub Labels

Francesco Sardone edited this page Jun 13, 2025 · 1 revision

labels Command

The labels command lets you manage GitHub repository labels using your local terminal via the ghitgud CLI. It supports listing, syncing, editing, and cleaning labels efficiently through the GitHub API.

Usage

ghitgud labels [options] [command]

Description

Manage labels for a repository.

Options

  • -h, --help – Display help for the labels command.

Subcommands

list

ghitgud labels list

Lists all labels for the current repository. Outputs metadata to the terminal including:

  • Label name
  • Color
  • Description

pull

ghitgud labels pull

Pulls all labels from the current GitHub repository and writes them to:

~/.config/ghitgud/labels.json

This file includes each label’s:

  • name
  • color
  • description

You can edit this file manually to:

  • Create new labels
  • Rename existing ones (by adding a "newName" field)
  • Modify descriptions or colors

push

ghitgud labels push

Pushes the local labels.json back to the GitHub repository, applying all changes:

  • Creates new labels
  • Updates existing ones
  • Renames labels using the "newName" key

prune

ghitgud labels prune

Deletes all existing labels in the GitHub repository that are not present in the current labels.json file.

Tip: Use pullprune → edit labels.jsonpush for a clean-slate label sync.


Label Templates

The ghitgud project includes pre-made label templates that you can use as a starting point. To use one:

  1. Copy a template JSON structure into:

    ~/.config/ghitgud/labels.json
    
  2. Optionally run prune to remove current labels from the repository.

  3. Run push to apply the template.

Clone this wiki locally