@gw-tools/gw 0.12.9 → 0.12.11
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.
- package/README.md +15 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -39,6 +39,10 @@ A command-line tool for managing git worktrees, built with Deno.
|
|
|
39
39
|
- [Arguments](#arguments-2)
|
|
40
40
|
- [Options](#options-3)
|
|
41
41
|
- [Examples](#examples-5)
|
|
42
|
+
- [clean](#clean)
|
|
43
|
+
- [Options](#options-4)
|
|
44
|
+
- [Examples](#examples-6)
|
|
45
|
+
- [How It Works](#how-it-works-2)
|
|
42
46
|
- [Git Worktree Proxy Commands](#git-worktree-proxy-commands)
|
|
43
47
|
- [list (ls)](#list-ls)
|
|
44
48
|
- [remove (rm)](#remove-rm)
|
|
@@ -174,6 +178,8 @@ gw init --root /path/to/your/repo.git
|
|
|
174
178
|
}
|
|
175
179
|
```
|
|
176
180
|
|
|
181
|
+
**More Examples**: See the [examples/](./examples/) directory for configuration templates for various project types (Next.js, Node.js API, monorepos, CI/CD, etc.).
|
|
182
|
+
|
|
177
183
|
### Configuration Options
|
|
178
184
|
|
|
179
185
|
- **root**: Absolute path to the git repository root (automatically detected or manually set with `gw init`)
|
|
@@ -196,6 +202,9 @@ gw add <worktree-name> [files...]
|
|
|
196
202
|
|
|
197
203
|
This command wraps `git worktree add` and optionally copies files to the new worktree. If `autoCopyFiles` is configured, those files are automatically copied. You can override this by specifying files as arguments.
|
|
198
204
|
|
|
205
|
+
**Branch Creation Behavior:**
|
|
206
|
+
When creating a new worktree without specifying an existing branch, `gw add` automatically fetches the latest version of your default branch (e.g., `main`) from the remote (e.g., `origin/main`) to ensure your new branch is based on the most recent code. If the remote is unavailable (no network or no remote configured), it gracefully falls back to using the local branch with a warning message.
|
|
207
|
+
|
|
199
208
|
#### Arguments
|
|
200
209
|
|
|
201
210
|
- `<worktree-name>`: Name or path for the new worktree
|
|
@@ -411,6 +420,7 @@ gw init [options]
|
|
|
411
420
|
- `--auto-copy-files <files>`: Comma-separated list of files to auto-copy when creating worktrees with `gw add`
|
|
412
421
|
- `--pre-add <command>`: Command to run before `gw add` creates a worktree (can be specified multiple times)
|
|
413
422
|
- `--post-add <command>`: Command to run after `gw add` creates a worktree (can be specified multiple times)
|
|
423
|
+
- `--clean-threshold <days>`: Number of days before worktrees are considered stale for `gw clean` (default: 7)
|
|
414
424
|
- `-h, --help`: Show help message
|
|
415
425
|
|
|
416
426
|
#### Examples
|
|
@@ -437,8 +447,11 @@ gw init --default-source master
|
|
|
437
447
|
# Initialize with explicit repository root
|
|
438
448
|
gw init --root /Users/username/Workspace/my-project.git
|
|
439
449
|
|
|
450
|
+
# Initialize with custom clean threshold (14 days instead of default 7)
|
|
451
|
+
gw init --clean-threshold 14
|
|
452
|
+
|
|
440
453
|
# Full configuration example
|
|
441
|
-
gw init --auto-copy-files .env,secrets/ --post-add "pnpm install"
|
|
454
|
+
gw init --auto-copy-files .env,secrets/ --post-add "pnpm install" --clean-threshold 14
|
|
442
455
|
|
|
443
456
|
# Show help
|
|
444
457
|
gw init --help
|
|
@@ -457,6 +470,7 @@ Hooks support variable substitution:
|
|
|
457
470
|
Use `gw init` to:
|
|
458
471
|
- Configure auto-copy files for automatic file copying on worktree creation
|
|
459
472
|
- Set up pre-add and post-add hooks for automation
|
|
473
|
+
- Configure the clean threshold for worktree age management
|
|
460
474
|
- Override the auto-detected repository root (rare)
|
|
461
475
|
- Change the default source worktree from "main" to something else
|
|
462
476
|
|