# git-workty
**Git worktrees as daily-driver workspaces.**
`workty` turns Git worktrees into instant, safe context switching—no stashing, no WIP commits. Create a task workspace in one command, jump between tasks with shell integration, and keep your repo tidy with safe cleanup.
## 30-Second Demo
```bash
# See all your workspaces
git workty
# Create a new workspace for a feature
git workty new feat/login
# With shell integration, cd into it directly
wnew feat/login # creates and cd's
wcd # fuzzy pick and cd
# See dashboard
git workty
# ▶ feat/login ● 3 ↑2↓0 ~/.workty/myrepo/feat-login
# main ✓ ↑0↓0 ~/src/myrepo
# Jump to another workspace
wgo main # or: cd "$(git workty go main)"
# Clean up merged branches
git workty clean --merged
```
## Installation
### From source
```bash
cargo install --path .
```
### Shell Integration
Add to your shell config (`.zshrc`, `.bashrc`, `config.fish`):
```bash
# Zsh
eval "$(git workty init zsh)"
# Bash
eval "$(git workty init bash)"
# Fish
This provides:
- `wcd` - fuzzy select and cd to a worktree
- `wnew <name>` - create new worktree and cd into it
- `wgo <name>` - go to a worktree by name
## Commands
### `git workty` / `git workty list`
Dashboard of all worktrees.
```
▶ main ✓ ↑0↓0 ~/src/repo
feat/login ● 3 ↑2↓0 ~/.workty/repo/feat-login
pr-512 ✓ - ~/.workty/repo/pr-512
```
- `▶` marks current worktree
- `●` with count shows uncommitted changes
- `✓` means clean
- `↑↓` shows commits ahead/behind upstream
Options:
- `--json` - machine-readable output
- `--ascii` - ASCII-only symbols
- `--no-color` - disable colors
### `git workty new <name>`
Create a new workspace.
```bash
git workty new feat/login # new branch from base
git workty new hotfix --from main # specify base
git workty new feature --print-path # print path only (for scripts)
git workty new feature --open # open in editor
```
### `git workty go <name>`
Print path to a worktree (for `cd`).
```bash
cd "$(git workty go feat/login)"
```
### `git workty pick`
Interactive fuzzy selector.
```bash
cd "$(git workty pick)"
```
### `git workty rm <name>`
Remove a workspace.
```bash
git workty rm feat/login # prompts if dirty
git workty rm feat/login --force # remove even if dirty
git workty rm feat/login --delete-branch # also delete branch
```
### `git workty clean`
Remove merged/stale worktrees.
```bash
git workty clean --merged --dry-run # preview
git workty clean --merged --yes # no prompt
```
### `git workty pr <number>`
Create workspace for a GitHub PR (requires `gh` CLI).
```bash
git workty pr 123
cd "$(git workty pr 456 --print-path)"
```
### `git workty doctor`
Diagnose common issues.
### `git workty completions <shell>`
Generate shell completions.
```bash
git workty completions zsh > _git-workty
```
## Configuration
Config is stored in `$(git rev-parse --git-common-dir)/workty.toml`:
```toml
version = 1
# Base branch for new workspaces and merge detection
base = "main"
# Root directory for workspaces
# {repo} = repository name, {id} = unique repo identifier
root = "~/.workty/{repo}-{id}"
# Layout style: "flat" (default)
layout = "flat"
# Editor command for --open flag
open_cmd = "code"
```
## Safety
- **Never destroys work by default** - dirty worktrees require `--force`
- **Prompts for destructive operations** - unless `--yes` is passed
- **Clear error messages** - always tells you what to do next
## License
Licensed under either of
- Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
at your option.