@gw-tools/gw 0.20.11 → 0.20.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +31 -22
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1110,12 +1110,12 @@ Use `gw show-init` to:
1110
1110
  Sync files and directories between worktrees, preserving directory structure.
1111
1111
 
1112
1112
  ```bash
1113
- gw sync [options] <target-worktree> [files...]
1113
+ gw sync [options] [target-worktree] [files...]
1114
1114
  ```
1115
1115
 
1116
1116
  #### Arguments
1117
1117
 
1118
- - `<target-worktree>`: Name or full path of the target worktree
1118
+ - `[target-worktree]`: Name or full path of the target worktree. If omitted, defaults to the current worktree
1119
1119
  - `[files...]`: One or more files or directories to sync (paths relative to worktree root). If omitted, uses `autoCopyFiles` from `.gw/config.json`
1120
1120
 
1121
1121
  #### Options
@@ -1127,7 +1127,10 @@ gw sync [options] <target-worktree> [files...]
1127
1127
  #### Examples
1128
1128
 
1129
1129
  ```bash
1130
- # Sync autoCopyFiles from config (if configured)
1130
+ # Sync autoCopyFiles to current worktree (if inside a worktree)
1131
+ gw sync
1132
+
1133
+ # Sync autoCopyFiles from config to a specific target
1131
1134
  gw sync feat-branch
1132
1135
 
1133
1136
  # Sync .env file from main to feat-branch
@@ -1205,7 +1208,8 @@ The clean command:
1205
1208
  | `gw clean` | No (all worktrees) | Yes (unless --force) | Clean up all finished work |
1206
1209
  | `gw clean --use-autoclean-threshold` | Yes (7+ days) | Yes (unless --force) | Clean up old, stale worktrees |
1207
1210
  | `gw clean --force` | No (all worktrees) | No | Force removal of all worktrees |
1208
- | `gw prune --clean` | No (all worktrees) | No | Git's native cleanup (no gw safety) |
1211
+ | `gw prune` | No (all worktrees) | Yes | Full cleanup (worktrees + branches) |
1212
+ | `gw prune --stale-only` | N/A | N/A | Git passthrough (metadata only) |
1209
1213
 
1210
1214
  **Safety Features:**
1211
1215
 
@@ -1301,13 +1305,13 @@ gw mv feat-branch ../new-location
1301
1305
 
1302
1306
  #### prune
1303
1307
 
1304
- Clean up worktree administrative data and optionally remove clean worktrees.
1308
+ Clean up worktrees and orphan branches. By default, performs full cleanup (removes clean worktrees AND deletes orphan branches).
1305
1309
 
1306
- **Standard Mode** (without `--clean`):
1307
- Wraps `git worktree prune` to clean up administrative files for deleted worktrees.
1310
+ **Default Mode (full cleanup):**
1311
+ Removes worktrees that are safe to delete (no uncommitted changes, no unpushed commits) AND deletes orphan branches (branches without associated worktrees).
1308
1312
 
1309
- **Clean Mode** (with `--clean`):
1310
- First runs `git worktree prune`, then removes ALL worktrees that have no uncommitted changes, no staged files, and no unpushed commits. This is similar to default `gw clean` behavior but with additional protections for the default branch.
1313
+ **Stale-Only Mode** (with `--stale-only`):
1314
+ Git passthrough - only cleans up administrative files for deleted worktrees. Does not remove worktrees or branches.
1311
1315
 
1312
1316
  ```bash
1313
1317
  gw prune [options]
@@ -1315,42 +1319,47 @@ gw prune [options]
1315
1319
 
1316
1320
  **Options:**
1317
1321
 
1318
- - `--clean` - Enable clean mode (remove clean worktrees)
1322
+ - `--stale-only` - Git passthrough mode (only metadata cleanup)
1323
+ - `--no-branches` - Skip orphan branch cleanup (worktrees only)
1319
1324
  - `-n, --dry-run` - Preview what would be removed
1320
1325
  - `-f, --force` - Skip confirmation prompt
1321
1326
  - `-v, --verbose` - Show detailed output
1322
1327
  - `-h, --help` - Show help
1323
1328
 
1324
- **Safety Features** (in clean mode):
1329
+ **Safety Features:**
1325
1330
 
1326
1331
  - Default branch is protected (configured in `.gw/config.json`)
1327
1332
  - gw_root branch is protected (bare repository root)
1328
1333
  - Current worktree cannot be removed
1329
1334
  - Bare repository is never removed
1330
- - Confirmation prompt before removal (defaults to yes, just press Enter to confirm)
1335
+ - Branches with unpushed commits are protected
1336
+ - Confirmation prompt before removal (defaults to yes)
1331
1337
 
1332
1338
  **Examples:**
1333
1339
 
1334
1340
  ```bash
1335
- # Standard prune (cleanup administrative data)
1336
- gw prune
1337
- gw prune --verbose
1341
+ # Full cleanup (default) - removes worktrees AND orphan branches
1342
+ gw prune # Remove clean worktrees and orphan branches
1343
+ gw prune --dry-run # Preview what would be removed
1344
+ gw prune --force # Skip confirmation
1345
+ gw prune --verbose # Show detailed output
1346
+
1347
+ # Skip branch cleanup
1348
+ gw prune --no-branches # Only clean worktrees, keep branches
1338
1349
 
1339
- # Clean mode (remove clean worktrees)
1340
- gw prune --clean # Remove all clean worktrees (with prompt)
1341
- gw prune --clean --dry-run # Preview what would be removed
1342
- gw prune --clean --force # Remove without confirmation
1343
- gw prune --clean --verbose # Show detailed output
1350
+ # Git passthrough (stale-only)
1351
+ gw prune --stale-only # Only clean git metadata (like git worktree prune)
1344
1352
  ```
1345
1353
 
1346
1354
  **Comparison with `gw clean`:**
1347
- | Feature | `gw clean` | `gw clean --use-autoclean-threshold` | `gw prune --clean` |
1355
+ | Feature | `gw clean` | `gw clean --use-autoclean-threshold` | `gw prune` |
1348
1356
  |---------|-----------|-------------------------------------|-------------------|
1349
1357
  | Age-based | No (all worktrees) | Yes (configurable threshold) | No (removes all clean) |
1350
1358
  | Safety checks | Yes | Yes | Yes |
1351
1359
  | Protects default branch | No | No | Yes |
1360
+ | Deletes orphan branches | No | No | Yes |
1352
1361
  | Runs `git worktree prune` | No | No | Yes |
1353
- | Use case | Clean up finished work | Regular maintenance | Aggressive cleanup |
1362
+ | Use case | Clean up finished work | Regular maintenance | Full cleanup |
1354
1363
 
1355
1364
  #### lock
1356
1365
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gw-tools/gw",
3
- "version": "0.20.11",
3
+ "version": "0.20.12",
4
4
  "description": "A command-line tool for managing git worktrees - copy files between worktrees with ease",
5
5
  "keywords": [
6
6
  "git",