A zsh plugin for GitHub workflow automation — fuzzy branch management, repo navigation, and commit search, all from the terminal.
- macOS Catalina (10.15) or later — ships with zsh as default
git,gh(GitHub CLI),fzf— see Installation
git clone https://github.com/WilliamDavidson-02/gfunc ~/.config/zsh/gfunc
~/.config/zsh/gfunc/install.shThe install script will:
- Check/install
git,gh, andfzfvia Homebrew - Optionally install
universal-ctags(for bettergfunc search --symbolsupport) - Run
gh auth loginif not already authenticated - Print the line to add to your
.zshrc
Oh My Zsh
git clone https://github.com/WilliamDavidson-02/gfunc \
${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/gfunc
# Add gfunc to plugins=() in ~/.zshrcManual
# Add to ~/.zshrc:
source ~/.config/zsh/gfunc/gfunc.plugin.zshInteractively pick a GitHub account and repo to clone via fzf. After cloning, automatically cds into the repo.
gfunc cloneOpen the current repo on GitHub in your browser.
gfunc open # repo root
gfunc open -b # current branch
gfunc open -pr # open PR for current branchPreview and bulk-delete stale local branches by last-commit age. All matching branches are pre-selected in fzf — TAB to deselect any you want to keep. Requires typing yes to confirm.
Never touches main, master, develop, dev, trunk, or your current branch.
gfunc prune # default: 1 month
gfunc prune 1w # older than 1 week
gfunc prune 2w
gfunc prune 3m
gfunc prune 6mFind local branches whose remote tracking branch has been deleted (e.g. merged PRs). Runs git fetch --prune first, then shows matching branches in fzf with a commit preview. Requires typing yes to confirm deletion.
gfunc goneSearch commit history and open results in the browser.
| Mode | Description |
|---|---|
--latest-file |
Fuzzy search all tracked files — opens the latest commit for the selected file |
--symbol |
Step 1: pick a file. Step 2: pick a func or type definition. Opens the latest commit that touched it |
--message |
Live search by commit message — list updates as you type |
| Flag | Description |
|---|---|
-a, --author <name> |
Filter by author (works with any mode) |
-b, --branch [name] |
Scope to a branch (see below) |
gfunc search --message # all remote branches
gfunc search --message -b # remote of your current branch
gfunc search --message -b develop # origin/develop specificallygfunc search --message
gfunc search --message -b develop
gfunc search --message -b -a <author>
gfunc search --latest-file -b main
gfunc search --symbol -b main| Package | Required | Used by |
|---|---|---|
git |
✅ | everything |
gh |
✅ | clone, open -pr |
fzf |
✅ | everything |
universal-ctags |
optional | search --symbol (falls back to regex without it) |
Install everything:
brew install git gh fzf universal-ctagsgfunc requires zsh 5.0+. It uses zsh-specific features ([[, arrays, process substitution) that are not compatible with fish, nushell, or POSIX sh. It will also work in bash 4+ but is not officially supported there.
macOS Catalina (2019) and later ship with zsh as the default shell, so no setup is needed on modern Macs.
gfunc/
├── gfunc.plugin.zsh ← entry point — sources libs, defines dispatcher
├── install.sh ← dependency bootstrapper
├── README.md
└── lib/
├── helpers.zsh ← shared: _gfunc_base_url, _gfunc_open_commit, etc.
├── clone.zsh
├── open.zsh
├── prune.zsh
├── gone.zsh
└── search.zsh