Skip to content
remcostoetenPublic

About

Fast gh CLI extension to fuzzy-search your GitHub repos, browse any repo's file tree without cloning, and partial (sparse) clone only the folders you need. Go-powered terminal UI, no fzf or jq required.

Topics

Resources

Stars

3 stars

Watchers

0 watching

Forks

Repository files navigation

gh-select

A gh extension to find, browse and clone GitHub repositories from one terminal screen.

release CI license go: 1.26 runs as: gh extension platforms: macOS, Linux, Windows, FreeBSD

Starting gh select, filtering to the gh-select repo, opening Browse files, previewing README.md and saving it with s, marking README.md and cli.go with space and partial cloning them with c, then tabbing to GitHub search for charmbracelet bubbletea and opening its action menu

gh select is an extension for the GitHub CLI. Browse all your repositories, clone one, open it in your editor or grab only the files and folders you need. For someone else's code, search all of GitHub by name, owner or URL from the same list.

gh extension install remcostoeten/gh-select
  • Search your own, organization and collaborator repos from a local cache, your starred repos, or all of GitHub by name, owner or pasted URL.
  • Browse any repository's file tree and preview files, with markdown rendered, before cloning anything.
  • Partial clone only the files and folders you mark, with git clone --filter=blob:none --sparse, or save them without git.
  • Local clones anywhere under your home directory are tagged, and their menu offers open in editor and pull.
  • Releases list their notes and assets, preselect the build for your machine, verify checksums and unpack archives.
  • Delete repositories you own, one at a time or in bulk, behind a retyped confirmation.

Usage

gh select

Type to filter the list. tab and shift+tab switch between your repos, your starred repos and GitHub search, ctrl+s changes the sort and ctrl+t cycles themes. ? on an empty search shows every key, your GitHub API rate limits and links to the source and issues. enter opens the action menu for the highlighted repo.

Search and filters

GitHub search takes a name, an owner, owner/repo, owner repo, owner-repo, a URL, an SSH remote or a whole git clone command. A partial owner such as heygen liveav still finds heygen-com/liveavatar-*. Pasting a URL into any list switches to GitHub search.

Filter tokens work in every list and combine with text, as in cli lang:go is:mine:

Token Keeps
lang:go repos whose main language is Go
is:public, is:private public or private repos
is:fork, is:source forks or original repos
is:local repos you have cloned
is:mine repos you own

Browse and partial clone

Choose Browse files from the action menu to open the tree. It works for any public repository, so tab to GitHub search first to browse someone else's code.

Key Action
↑ ↓ → ← move, open a folder or preview a file, go up
/ filter the current folder
space mark a file or folder
c partial clone of what you marked
s save the marked or highlighted files without git
y copy the file's contents
b switch to another branch or tag
o / Y / r open on github.com, copy a permalink, copy the raw URL

Saved files never overwrite existing ones; the new copy gets a -1 suffix.

Releases

Releases in the action menu lists the last 100 releases with their notes. enter opens the downloads with the file for your OS and CPU preselected. space marks several, enter downloads and x downloads and unpacks .tar.gz, .tgz, .tar.bz2 and .zip archives. Downloads are checked against the release's checksum files and land in --download-dir, GH_SELECT_DOWNLOAD_DIR or the current directory.

Deleting repositories

ctrl+x marks a repository you own and ctrl+d opens a confirmation screen for everything marked. You retype the repository's name, or DELETE <n> for a batch. Local clones are listed but never removed. GitHub needs an extra scope for this:

gh auth refresh -s delete_repo

Clone directory and local clones

Set a clone root and gh-select clones there instead of the current directory:

export GH_SELECT_CLONE_DIR=~/dev

Existing clones are found anywhere under your home directory, including git worktrees and submodules, and matched by their git remote. GH_SELECT_SCAN_DIRS lists directories to search first, separated like PATH.

Themes

Built in: catppuccin (default), dracula, everforest, graphite, gruvbox, kanagawa, nord, rose-pine, solarized and tokyonight, each with a light and dark variant picked from the terminal background. Set one with --theme NAME or GH_SELECT_THEME, or press ctrl+t, which saves the choice to ~/.config/gh-select/theme.

A custom theme is a JSON file in ~/.config/gh-select/themes/, named after the theme. Colors left out come from the theme in extends, which can be built in or custom:

{
  "extends": "nord",
  "dark": { "hl": "#c792ea", "pink": "#ff5370" },
  "light": { "hl": "#7c4dff" }
}

The colors are bg, fg, dim, hl, cyan, blue, green, pink, yellow and red, each as #rrggbb. --border adds boxes around panels, --transparent keeps the terminal background, and --icons none replaces the Nerd Font icons with words.

Commands and options

Each command works as a word, a short flag or a long flag, and takes -h for its own help.

gh select doctor             # check git, gh and your GitHub login (--doctor)
gh select limits             # show API rate limit usage (-l, --limits)
gh select refresh            # refetch the repo cache and exit (-r, --refresh)
gh select version            # print the version (-v, --version)
gh select help [command]     # overview, or one command's help (-h, --help)

gh select -n, --no-cache     # skip the cache and fetch fresh data
gh select -d, --dir DIR      # clone into DIR
gh select -p, --print-path   # print the picked repo's path on stdout

gh select help lists every option and environment variable, including GH_SELECT_CACHE_TTL (seconds, default 1800). Unknown commands exit with status 2 and suggest the closest match.

Install

Needs GitHub CLI logged in with gh auth login, and git.

gh extension

gh extension install remcostoeten/gh-select
gh extension upgrade gh-select

Standalone binary

Each release ships a binary per platform, named like linux-amd64 or darwin-arm64:

curl -L -o gh-select https://github.com/remcostoeten/gh-select/releases/latest/download/linux-amd64
chmod +x gh-select && mv gh-select ~/.local/bin/

Go

go install github.com/remcostoeten/gh-select@latest

Development

Requires Go 1.26 or newer.

scripts/dev.sh check     # vet, test and build
scripts/dev.sh run       # build and run ./gh-select
scripts/dev.sh install   # install the local build as gh select
scripts/dev.sh demo      # re-record assets/showcase.gif with vhs and Remotion

xxx,
Remco Stoeten
MIT

About

Fast gh CLI extension to fuzzy-search your GitHub repos, browse any repo's file tree without cloning, and partial (sparse) clone only the folders you need. Go-powered terminal UI, no fzf or jq required.

Topics

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages