Script

repos.zsh

List, navigate and open repos quickly from the command line

Download repos.zsh

Written with LLM assistance. Review before running.
v0.1.2 · Updated 2026-03-08

A zsh shell function that makes it fast to jump between git repos. Shows a numbered list of favourites and recently visited repos, so you can cd or open in VS Code with a single short command.

Demo

Video showing repos.zsh in use. A user types 'repos' in terminal and is given a list of favourite repos and recently accessed. They then type 'repos 2' to cd directly to the second favourite

Example

$ repos
Favourites:
  [1]  frontend             work/frontend
  [2]  site                 personal/my-site

Recently accessed:
  [3]  api-service
  [4]  docs

$ repos frontend    # cd to frontend
$ repos 2           # cd to site
$ repos add api     # bookmark current dir as 'api', then source ~/.zshrc to apply
$ code frontend     # open the frontend repo in VS Code

Installation

  1. Download repos.zsh and source it in your .zshrc:
source ~/path/to/repos.zsh
  1. Reload your shell:
source ~/.zshrc

On first run, ~/.reposrc is created automatically with defaults you can customise.

Configuration

Edit ~/.reposrc (or run repos edit):

# Root folder that contains all your repos
REPOS_DIR="$HOME/code"

# Subfolders of REPOS_DIR that themselves contain repos
# e.g. if you have Code/work/project-a, Code/work/project-b
REPOS_GROUPS=("work" "personal")

# Favourites — short aliases for repos you use most
fav frontend "work/frontend"
fav site     "personal/my-site"

Usage

repos              List favourites and recently accessed repos
repos -a           List all repos
repos <name>       cd to a repo by name or favourite alias
repos <number>     cd to a repo by number from the last list
repos add <name>   Add current directory as a favourite
repos edit         Open ~/.reposrc in $EDITOR
repos --help       Show usage

code works the same way but opens the repo in VS Code instead of cd-ing to it:

code tools       # open the 'tools' favourite in VS Code
code 3           # open item 3 from the last list

Features

  • Numbered navigation — run repos to get a list, then repos 3 to jump there; the index persists between repos and code calls
  • Colour output — section headings in yellow, repo names in cyan, indices dimmed; makes lists easy to scan at a glance
  • Favourites with aliases — map short names to long paths via fav in ~/.reposrc
  • Recent history — automatically tracks the last 8 repos visited; shows them below favourites
  • Group support — walk into subfolders (e.g. work/, personal/) to find repos without them being top-level
  • Tab completion — aliases and folder names complete with <Tab>

Version history

Version Date Notes
0.1.3 2026-03-10 Fix bug with handling of . and ~
0.1.2 2026-03-08 Tweak formatting
0.1.1 2026-03-08 Fix bug with absolute paths and tweak colours
0.1 2026-03-08 Initial release