Tip: Using the GitHub CLI to Copy Labels Between Repositories
Tip
If you manage multiple GitHub repositories and want consistent labels, drift happens quickly.
Use GitHub CLI to run gh label clone and copy a source repository's labels into a destination repository.
If gh is not installed yet, install it first:
Then authenticate:
That second command is worth running. It confirms that your session is active before you try to modify repository settings.
Clone Labels into the Current Repository¶
If you are already in the destination repository directory, the command is simple:
Example:
That copies every label from tenthirtyam/example into the current repository.
Target a Different Destination Repository¶
If you are not inside the destination repository, use --repo:
Example:
This is the version I use most often. It is explicit, and explicit is better when you are changing repository metadata.
Overwrite Existing Labels¶
By default, labels that already exist in the destination repository are skipped. If you want the source repository's label definitions (color and description) to win, add --force:
Example:
What the Command Does Not Do¶
gh label clone is usefully conservative:
- It copies all labels from the source repository to the destination repository.
- It skips labels that already exist unless you use
--force. - It does not delete destination labels that are missing from the source repository.
That last point matters. This is a clone-and-merge operation, not a destructive sync.
When to Use It¶
This command is especially useful when:
- You are standardizing labels across an organization.
- You created a new repository and want the same triage taxonomy as an existing one.
- You cleaned up one repository's labels and want to reuse that set elsewhere.
Enjoy!