git-warp 0.1.0

High-performance, UX-focused Git worktree manager combining CoW speed with advanced features
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
# Git-Warp User Guide

**The Ultimate Git Worktree Manager: Lightning-Fast, AI-Integrated, and Developer-Friendly**

## Table of Contents

1. [What is Git-Warp?]#what-is-git-warp
2. [Why Use Git-Warp?]#why-use-git-warp
3. [Installation]#installation
4. [Quick Start]#quick-start
5. [Core Features]#core-features
6. [Advanced Usage]#advanced-usage
7. [Configuration]#configuration
8. [Troubleshooting]#troubleshooting
9. [Best Practices]#best-practices

---

## What is Git-Warp?

Git-Warp is a high-performance Git worktree manager that revolutionizes how developers work with multiple branches simultaneously. Built in Rust for maximum speed and reliability, it combines:

- **⚡ Instant Worktree Creation**: Copy-on-Write (CoW) technology creates worktrees in milliseconds
- **🤖 AI Integration**: Live monitoring of Claude Code agent activities
- **🛡️ Process Safety**: Intelligent process detection and management
- **🖥️ Terminal Integration**: Seamless switching between worktrees in your favorite terminal
- **⚙️ Rich Configuration**: Powerful, layered configuration system

### The Problem Git-Warp Solves

Traditional Git workflows force developers to choose between:
- **Stashing/Committing**: Interrupting current work to switch branches
- **Multiple Repositories**: Managing separate clones (disk space, sync issues)
- **Manual Worktrees**: Complex `git worktree` commands with cleanup headaches

Git-Warp eliminates these compromises by making worktrees effortless, instant, and intelligent.

---

## Why Use Git-Warp?

### 🚀 **Speed That Changes Everything**

```bash
# Traditional approach (30+ seconds)
git stash
git checkout feature-branch
npm install
# Work on feature
git checkout main
git stash pop

# Git-Warp approach (< 1 second)
warp feature-branch
# Instantly ready to work - dependencies already installed!
```

### 🧠 **Intelligence Built-In**

- **Process Detection**: Never accidentally break running services
- **Branch Analysis**: Automatic detection of merged/stale branches
- **Agent Monitoring**: See what Claude Code is doing in real-time
- **Smart Cleanup**: AI-powered suggestions for worktree maintenance

### 💎 **Developer Experience**

- **Zero Configuration**: Works perfectly out-of-the-box
- **Rich Feedback**: Beautiful, informative CLI output
- **Error Prevention**: Dry-run mode for all destructive operations
- **Terminal Magic**: Automatic tab/window switching

---

## Installation

### Prerequisites

- **Rust**: 2024 edition (latest stable)
- **Git**: Any modern version
- **macOS**: Required for Copy-on-Write support (APFS filesystem)

### Build from Source

```bash
# Clone the repository
git clone https://github.com/your-org/git-warp
cd git-warp

# Build optimized binary
cargo build --release

# The binary will be at target/release/warp
# Optionally, add to your PATH
sudo ln -sf $(pwd)/target/release/warp /usr/local/bin/warp
```

### Verify Installation

```bash
warp --version
# Should output: warp 0.1.0
```

---

## Quick Start

### Your First Worktree

```bash
# Navigate to any Git repository
cd your-project

# Create and switch to a new feature branch (instant!)
warp feature/amazing-new-feature

# List all worktrees
warp ls

# Work normally - everything is ready to go!
```

### Essential Commands

```bash
# Switch to existing branch
warp switch existing-branch

# List worktrees with details
warp ls --debug

# Clean up merged branches
warp cleanup --mode merged

# View configuration
warp config --show

# Monitor AI agents (if using Claude Code)
warp agents
```

---

## Core Features

### 1. Instant Worktree Creation

Git-Warp uses Copy-on-Write technology to create worktrees instantly:

```bash
# Creates worktree in milliseconds vs. minutes
warp feature/user-authentication

# Custom path
warp switch feature/ui-redesign --path /custom/path

# Force traditional method (skip CoW)
warp switch testing-branch --no-cow
```

**How it Works**: On APFS filesystems (macOS), Git-Warp clones your repository's file tree instantly using CoW, then intelligently rewrites absolute paths in configuration files.

### 2. Intelligent Worktree Management

**List Worktrees**:
```bash
warp ls
# Output:
# 📁 Git Worktrees:
# 
# 🏠  main /Users/you/project
# 🌿  feature-branch /Users/you/project/../worktrees/feature-branch
# 🌿  hotfix-123 /Users/you/project/../worktrees/hotfix-123
# 
# 📊 Total: 3 worktrees
```

**Advanced Listing**:
```bash
warp ls --debug
# Shows HEAD commits, branch status, and more details
```

### 3. Smart Cleanup

Git-Warp analyzes your branches intelligently:

```bash
# Clean up merged branches
warp cleanup --mode merged

# Clean up branches without remotes
warp cleanup --mode remoteless

# Interactive cleanup (TUI interface)
warp cleanup --interactive

# Dry-run to see what would be cleaned
warp --dry-run cleanup --mode all
```

**Cleanup Modes**:
- `merged`: Branches merged into main/master
- `remoteless`: Branches without remote tracking
- `all`: All non-main worktrees (use with caution!)
- `interactive`: Choose which worktrees to remove

### 4. Process Safety

Git-Warp prevents disasters by detecting running processes:

```bash
# Automatically detects processes in worktrees
warp cleanup --mode merged

# If processes are found:
# ⚠️  Found 2 processes in worktree
#   • PID 1234: npm (CPU: 15.2%, Mem: 45MB)
#     Working dir: /project/worktrees/feature-branch
#   • PID 5678: webpack-dev-server (CPU: 8.1%, Mem: 120MB)
#     Command: node webpack serve --mode development

# Kill processes automatically
warp cleanup --mode merged --kill

# Force cleanup ignoring processes
warp cleanup --mode merged --force
```

### 5. Terminal Integration

Seamless integration with macOS terminals:

```bash
# Open new tab (default)
warp switch feature-branch

# Open new window
warp switch --terminal window feature-branch

# Echo commands instead of switching
warp switch --terminal echo feature-branch

# Stay in current location
warp switch --terminal inplace feature-branch
```

### 6. AI Agent Monitoring

Real-time monitoring of Claude Code activities:

```bash
# Launch live dashboard
warp agents
```

**Dashboard Features**:
- Live agent activity feed
- CPU and memory usage
- Activity statistics
- Interactive navigation (↑↓ keys, r to refresh)

---

## Advanced Usage

### Configuration Management

**View Current Settings**:
```bash
warp config --show
# Shows all configuration with current values
```

**Generate Sample Config**:
```bash
warp config --edit
# Shows sample configuration and creates default if needed
```

**Environment Variables** (Override any setting):
```bash
export GIT_WARP_TERMINAL_MODE=window
export GIT_WARP_USE_COW=true
export GIT_WARP_AUTO_CONFIRM=false
export GIT_WARP_WORKTREES_PATH=/custom/worktrees
```

### Dry-Run Mode

Preview all operations safely:

```bash
# See what would be done
warp --dry-run switch feature-branch
warp --dry-run cleanup --mode all
warp --dry-run --terminal window switch testing
```

### Branch Naming & Patterns

Git-Warp handles complex branch names gracefully:

```bash
# Forward slashes (creates nested structure)
warp feature/user-auth/login-form

# Special characters
warp "hotfix/issue-#123"

# Automatic sanitization for filesystem paths
warp "feature branch with spaces"  # → feature-branch-with-spaces
```

### Custom Worktree Paths

```bash
# Specific path
warp switch mybranch --path /tmp/quick-test

# Pattern-based paths (configured)
# ~/worktrees/project-name/branch-name
```

### Integration with Development Workflow

**With Package Managers**:
```bash
# Dependencies are already installed via CoW!
warp feature/new-ui
cd ../worktrees/feature-new-ui
npm start  # Works immediately
```

**With Claude Code**:
```bash
# Monitor AI agent activity while developing
warp agents &  # Background monitoring
warp switch ai-integration
# Work with Claude Code while monitoring agent activities
```

**With Docker/Services**:
```bash
# Safe service management
warp cleanup --kill --mode merged  # Stops services in cleaned worktrees
warp switch main
docker-compose up  # Start services in main worktree
```

---

## Configuration

Git-Warp uses a sophisticated configuration system with three layers:

### 1. Configuration File

Located at: `~/.config/git-warp/config.toml`

```toml
# Terminal mode: tab, window, inplace, echo
terminal_mode = "tab"

# Use Copy-on-Write when available
use_cow = true

# Auto-confirm destructive operations
auto_confirm = false

# Custom worktrees directory (optional)
# worktrees_path = "/custom/path/to/worktrees"

[git]
# Default main branch name
default_branch = "main"

# Auto-fetch before operations
auto_fetch = true

# Auto-prune remote tracking branches
auto_prune = true

[process]
# Check for processes before cleanup
check_processes = true

# Auto-kill processes during cleanup
auto_kill = false

# Grace period before force killing (seconds)
kill_timeout = 5

[terminal]
# Terminal app: auto, iterm2, terminal
app = "auto"

# Auto-activate new tabs/windows
auto_activate = true

# Custom commands to run in new worktrees
# init_commands = ["npm install", "source .env"]

[agent]
# Enable agent monitoring
enabled = true

# Refresh rate for agent dashboard (milliseconds)
refresh_rate = 1000

# Maximum activities to track
max_activities = 100

# Enable Claude Code hooks integration
claude_hooks = true
```

### 2. Environment Variables

Override any setting with `GIT_WARP_` prefix:

```bash
# Terminal behavior
export GIT_WARP_TERMINAL_MODE=window
export GIT_WARP_AUTO_CONFIRM=true

# Performance
export GIT_WARP_USE_COW=false  # Disable CoW

# Paths
export GIT_WARP_WORKTREES_PATH=/Users/me/dev/worktrees
```

### 3. Command-Line Options

Highest priority, overrides everything:

```bash
warp --terminal window --auto-confirm switch feature-branch
```

### Configuration Priority

1. **Command-line options** (highest)
2. **Environment variables** 
3. **Configuration file**
4. **Built-in defaults** (lowest)

---

## Troubleshooting

### Common Issues

**CoW Not Working**:
```bash
# Check filesystem type
df -T .
# Should show "apfs" for CoW support

# Force traditional method
warp switch --no-cow branch-name
```

**Terminal Integration Issues**:
```bash
# Check terminal support
warp config --show
# Look for "Terminal Integration" section

# Try different terminal mode
warp --terminal echo switch branch-name
```

**Permission Errors**:
```bash
# Check directory permissions
ls -la ../worktrees/

# Create worktrees directory manually
mkdir -p ../worktrees
```

**Process Detection Issues**:
```bash
# Bypass process checks
warp cleanup --force --mode merged

# Check what processes are detected
warp --dry-run cleanup --mode merged
```

### Debug Mode

Enable verbose logging:

```bash
RUST_LOG=debug warp --debug switch feature-branch
```

### Recovery Operations

**Clean Up Corrupted Worktrees**:
```bash
# Remove broken worktree references
git worktree prune

# List remaining worktrees
git worktree list

# Manual removal if needed
rm -rf ../worktrees/broken-branch
git worktree remove --force broken-branch
```

**Reset Configuration**:
```bash
# Remove config file
rm ~/.config/git-warp/config.toml

# Regenerate default
warp config --edit
# Press 'y' when prompted
```

---

## Best Practices

### 1. Worktree Organization

**Recommended Structure**:
```
your-project/
├── .git/
├── main-branch-files/
└── ../worktrees/
    ├── feature-authentication/
    ├── hotfix-security-issue/
    └── experimental-ui/
```

**Naming Conventions**:
- Use descriptive, kebab-case names: `feature-user-auth`
- Include type prefix: `feature/`, `hotfix/`, `experiment/`
- Keep names short but clear

### 2. Development Workflow

**Daily Workflow**:
```bash
# Start of day
warp switch main
git pull

# New feature
warp feature/amazing-feature
# Work, commit, push

# Code review
warp switch main
# Review PRs

# Quick hotfix
warp hotfix/critical-bug
# Fix, test, deploy

# End of day cleanup
warp cleanup --mode merged
```

**Team Collaboration**:
- Share branch naming conventions
- Use consistent worktree organization
- Document custom configuration settings

### 3. Performance Optimization

**Maximize CoW Benefits**:
- Keep `node_modules/` and build artifacts in main worktree
- Use `.gitignore` to exclude large generated files
- Regularly clean up old worktrees

**Resource Management**:
- Monitor disk usage: `du -sh ../worktrees/*`
- Set reasonable limits in configuration
- Use cleanup commands regularly

### 4. Safety Practices

**Before Destructive Operations**:
```bash
# Always dry-run first
warp --dry-run cleanup --mode all

# Check for uncommitted changes
warp ls --debug

# Backup important work
git stash --include-untracked  # In each worktree
```

**Process Management**:
- Always check for running processes
- Use graceful termination (avoid --force unless necessary)
- Monitor services that might span worktrees

### 5. Integration Tips

**With IDEs**:
- Configure IDE to handle multiple project roots
- Use workspace features for multi-worktree development
- Set up consistent formatting/linting across worktrees

**With CI/CD**:
- Ensure CI systems understand worktree structure
- Use relative paths in configuration files
- Test deployment from different worktrees

**With Docker**:
- Be careful with volume mounts spanning worktrees
- Consider worktree-specific docker-compose files
- Clean up containers when removing worktrees

---

## Advanced Scenarios

### Large Monorepos

```bash
# Set custom worktree location to faster disk
export GIT_WARP_WORKTREES_PATH=/fast-ssd/worktrees

# Increase cleanup thresholds
warp config --edit
# Adjust max_activities and other limits
```

### Multi-Team Development

```bash
# Team-specific configuration
export GIT_WARP_TERMINAL_MODE=window  # For team preference
export GIT_WARP_AUTO_CONFIRM=false    # Safety for shared environments

# Standardize worktree structure
export GIT_WARP_WORKTREES_PATH=/teams/shared/worktrees
```

### Continuous Integration

```bash
# CI-friendly settings
export GIT_WARP_AUTO_CONFIRM=true
export GIT_WARP_USE_COW=false  # May not be available in CI
export GIT_WARP_TERMINAL_MODE=echo
```

---

Git-Warp transforms Git worktree management from a complex, error-prone process into an effortless, intelligent workflow. Whether you're working on small features or managing large monorepos, Git-Warp's combination of speed, safety, and intelligence makes it an indispensable tool for modern development.

**Happy warping! 🚀**