A bare-clone + worktree helper for Git. Keeps every branch in its own
directory so you can switch contexts without git stash.
myrepo/
.bare/ ← the actual git objects
main/ ← worktree for main
my-feature/ ← worktree for my-feature
Pick the right binary for your platform from the latest release:
| Platform | Binary |
|---|---|
| macOS (Apple Silicon) | gw-aarch64-apple-darwin |
| macOS (Intel) | gw-x86_64-apple-darwin |
| Linux x86_64 | gw-x86_64-unknown-linux-gnu |
| Linux arm64 | gw-aarch64-unknown-linux-gnu |
# Example: macOS Apple Silicon
curl -Lo gw https://github.com/tkgalk/gw/releases/latest/download/gw-aarch64-apple-darwin
chmod +x gw
mv gw /usr/local/bin/cargo install --git https://github.com/tkgalk/gwgw clone git@github.com:org/repo.git
# creates: repo/.bare/ and repo/<default-branch>/gw new myrepo
# creates: myrepo/.bare/ and myrepo/main/ (an empty worktree, no commits yet)
# Pick the initial branch name (defaults to git's init.defaultBranch, else "main")
gw new myrepo --branch trunkLike git init, this leaves you with an empty worktree and no commits — add a
remote yourself once you have one (git remote add origin <url>). Requires
git ≥ 2.42 (for git worktree add --orphan).
# Add a new worktree (creates branch off default branch)
gw worktree add my-feature
# Add off a specific base
gw worktree add my-feature --base origin/main
# Check out an existing branch
gw worktree add main --existing
# List all worktrees
gw worktree list
# Remove a worktree
gw worktree remove my-feature
# Prune stale bookkeeping (dry-run first)
gw worktree prune --dry-run
gw worktree pruneRun from any directory inside a gw-managed repo — it walks up to find the .bare/ directory automatically.