ggw

module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 11, 2026 License: MIT

README

ggw

Git worktrees, ergonomic. Stores all worktrees of all your repos in a single predictable location, derived from the repo's origin remote and the branch name.

~/.local/share/worktrees/<org>/<repo>/<branch-slug>/

For example, in a repo whose origin is git@github.com:acme/api.git:

Branch Worktree path
feature/login ~/.local/share/worktrees/acme/api/feature-login/
hotfix-123 ~/.local/share/worktrees/acme/api/hotfix-123/
BugFix/User A ~/.local/share/worktrees/acme/api/bugfix-user-a/

XDG_DATA_HOME is respected: if set, worktrees live under $XDG_DATA_HOME/worktrees/....

The branch name is not slugified — it is passed unchanged to git. Only the directory name is slugified.

Install

go install github.com/illegalstudio/ggw/cmd/ggw@latest

Or build from source:

git clone https://github.com/illegalstudio/ggw.git
cd ggw
make && make install

Usage

# from inside a repo:
ggw list                              # show all worktrees of the current repo
ggw list --json                       # machine-readable output
ggw create feature/login              # create worktree at .../<org>/<repo>/feature-login/
                                      # creates the branch from HEAD if it does not exist
ggw create fix --from main            # create branch from a specific base
ggw pr 123                            # create a tracked worktree for GitHub PR #123 (requires gh)
ggw cd feature/login                  # cd into a worktree (needs shell integration, see below)
ggw cd                                # interactive selector
ggw exec feature/login -- npm install # run a command inside a worktree
ggw delete feature/login              # remove a worktree and its branch (prompts to confirm)
ggw delete feature/login --without-branch --force  # keep the branch, skip confirm

ggw pr <id> uses GitHub CLI to check out the PR branch, so the created worktree keeps the tracking configuration that allows git push when GitHub permits pushing to the PR branch.

Shell integration

ggw cd needs a shell wrapper to actually change your shell's directory. Add to your shell config (once):

eval "$(ggw shell-init bash)"   # in ~/.bashrc
eval "$(ggw shell-init zsh)"    # in ~/.zshrc
ggw shell-init fish | source    # in ~/.config/fish/config.fish

The wrapper intercepts ggw cd and turns it into a real cd. Every other subcommand (list, create, ...) passes through unchanged.

Without the wrapper, ggw cd <name> simply prints the worktree path on stdout — useful for cd "$(ggw cd foo)" or piping into other tools.

Docs

See also

  • ggg — the sister project that inspired ggw.

Status

All commands are operative. See ROADMAP.md for the backlog (config file, post-create hooks, completions, releases).

License

MIT — see LICENSE.

Directories

Path Synopsis
cmd
ggw command
internal
cli
ui

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL