Overview
gitsw’s killer feature is automatic, per-branch stash management. When you switch branches with uncommitted changes, gitsw can automatically stash them and restore them when you return.Auto-Stash on Leave
When you have uncommitted changes and switch branches, gitsw prompts you:Stash Options
Stash changes (recommended)
Saves your changes with a branch-specific message:
git-switch: branch-nameThe stash OID is stored in .git/git-switch.json linked to your branchDiscard changes
Permanently deletes all uncommitted changesYou’ll get a confirmation prompt before discarding
How Stashing Works
Fromsrc/main.rs:388-424:
src/main.rs:456-500:
src/prompt.rs:101-123:
src/main.rs:425-430:
Terminal Examples
Quick Reference
| Command | Description |
|---|---|
gitsw branch | Auto-stash on leave, auto-restore on arrival |
gitsw branch --no-stash | Skip automatic stashing |
gitsw -l | List branches with stashes |
| Manual stash access | Use git stash list to see all stashes |
How It Compares to Git Stash
| Feature | Git Stash | gitsw |
|---|---|---|
| Stash changes | git stash | Automatic prompt |
| Apply stash | git stash pop | Automatic on return |
| Per-branch | Manual tracking | Automatic |
| Stash list | All stashes mixed | Per-branch tracking |
| Conflict handling | Manual resolution | Interactive prompts |