GitHub CLI extensions are community-built or custom commands that extend gh with new functionality. They are Git repositories whose name starts with gh- and contain an executable of the same name.
How Extensions Work
- An extension named
gh-dashprovides the commandgh dash - All arguments passed to
gh <extname>are forwarded to thegh-<extname>executable - Extensions cannot override built-in
ghcommands - Extension update checks happen once every 24 hours automatically
Discovering Extensions
Browse the Registry
gh extension browseThis opens an interactive TUI (terminal UI) for browsing available extensions.
Search for Extensions
gh extension search "dashboard"
gh extension search "label"
gh extension search --limit 30You can also browse the registry on GitHub: github.com/topics/gh-extension
Installing Extensions
# Install from a GitHub repository
gh extension install dlvhdr/gh-dash
gh extension install vilmibm/gh-screensaver
gh extension install mislav/gh-branch
# Install a specific version
gh extension install dlvhdr/gh-dash --pin v1.0.0Listing Installed Extensions
gh extension listUpgrading Extensions
# Upgrade a specific extension
gh extension upgrade dlvhdr/gh-dash
# Upgrade all installed extensions
gh extension upgrade --allRemoving Extensions
gh extension remove dlvhdr/gh-dashExecuting an Extension Directly
If an extension name conflicts with a built-in command or you want to invoke it explicitly, use exec:
gh extension exec <extname> [args...]This is useful when an extension has the same name as a core gh command — gh extension exec bypasses the built-in command and runs the extension directly.
Creating Your Own Extension
Scaffold a New Extension
# Create a basic shell script extension
gh extension create my-extension
# Create a Go-based extension (compiled binary)
gh extension create my-extension --precompiled=go
# Create an extension with other precompiled languages
gh extension create my-extension --precompiled=otherThis creates a repository called gh-my-extension with the boilerplate structure.
Extension Structure
A minimal shell extension:
gh-my-extension/
├── gh-my-extension # Executable script (Bash, Python, etc.)
A Go extension:
gh-my-extension/
├── main.go
├── go.mod
├── go.sum
└── .github/
└── workflows/
└── release.yml # Auto-builds binaries for all platforms
Shell Script Example
#!/usr/bin/env bash
# gh-my-extension
set -e
echo "Hello from my custom gh extension!"
echo "Repository: $(gh repo view --json nameWithOwner --jq '.nameWithOwner')"
echo "Arguments: $@"Publishing
- Push your extension repo to GitHub
- Ensure the repo name starts with
gh- - Add the
gh-extensiontopic to the repo - Others can install it with
gh extension install yourname/gh-my-extension
Popular Extensions
| Extension | Command | Description |
|---|---|---|
| gh-dash | gh dash | Beautiful dashboard for PRs and issues |
| gh-copilot | gh copilot | AI-powered suggestions in the terminal |
| gh-poi | gh poi | Clean up local branches safely |
| gh-branch | gh branch | Fuzzy branch finder |
| gh-markdown-preview | gh markdown-preview | Preview markdown files locally |
Disabling Update Notifications
export GH_NO_EXTENSION_UPDATE_NOTIFIER=1Aliases
The gh extension command also responds to gh ext and gh extensions.
Exercises
- Search for extensions:
gh extension search "dashboard" - Install one:
gh extension install dlvhdr/gh-dash - List installed:
gh extension list - Try it:
gh dash - Create your own:
gh extension create hello-world - Clean up:
gh extension remove dlvhdr/gh-dash