@gw-tools/gw 0.63.0 → 0.64.0-beta.75.1

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 +62 -4
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -80,6 +80,10 @@ A command-line tool for managing git worktrees, built with Deno.
80
80
  - [Options](#options-7)
81
81
  - [Examples](#examples-8)
82
82
  - [How It Works](#how-it-works-4)
83
+ - [protect](#protect)
84
+ - [Examples](#examples-protect)
85
+ - [unprotect](#unprotect)
86
+ - [Examples](#examples-unprotect)
83
87
  - [Git Worktree Proxy Commands](#git-worktree-proxy-commands)
84
88
  - [list (ls)](#list-ls)
85
89
  - [remove (rm)](#remove-rm)
@@ -385,6 +389,7 @@ All fields are optional and safe to commit — no machine-specific paths or runt
385
389
  - **cleanThreshold**: Number of days before worktrees are considered stale for `gw clean` (defaults to 7, set via `gw init --clean-threshold`)
386
390
  - **autoClean**: Silently remove stale worktrees in the background when running `gw checkout` or `gw list` (defaults to false, set via `gw init --auto-clean`)
387
391
  - **updateStrategy**: Default strategy for `gw update` command: "merge" or "rebase" (defaults to "merge", set via `gw init --update-strategy`)
392
+ - **protectedBranches**: Array of branch names protected from `gw clean` and auto-clean (managed with `gw protect` / `gw unprotect`)
388
393
 
389
394
  ### Local Overrides (`config.local.json`)
390
395
 
@@ -1480,7 +1485,7 @@ These commands wrap native `git worktree` operations, providing consistent color
1480
1485
 
1481
1486
  #### list (ls)
1482
1487
 
1483
- List all worktrees in the repository.
1488
+ List all worktrees in the repository. Protected branches (the default branch, `main`, `master`, `gw_root`, and any branches marked with `gw protect`) are annotated with a `[protected]` tag.
1484
1489
 
1485
1490
  ```bash
1486
1491
  gw list
@@ -1491,11 +1496,13 @@ gw ls
1491
1496
  **Examples:**
1492
1497
 
1493
1498
  ```bash
1494
- gw list # List all worktrees
1495
- gw list --porcelain # Machine-readable output
1496
- gw list -v # Verbose output
1499
+ gw list # List all worktrees (with [protected] annotations)
1500
+ gw list --porcelain # Machine-readable output (raw git proxy, no annotation)
1501
+ gw list -v # Verbose output (raw git proxy, no annotation)
1497
1502
  ```
1498
1503
 
1504
+ > **Note:** `--porcelain`, `-z`, `--verbose`, and `-v` fall back to the raw `git worktree list` proxy so machine-readable and scripting use cases are never broken.
1505
+
1499
1506
  #### remove (rm)
1500
1507
 
1501
1508
  Remove a worktree from the repository. By default, also deletes the local branch to prevent orphaned branches.
@@ -1636,6 +1643,57 @@ gw prune --stale-only # Only clean git metadata (like git worktree prune)
1636
1643
  | Runs `git worktree prune` | No | No | Yes |
1637
1644
  | Use case | Clean up finished work | Regular maintenance | Full cleanup |
1638
1645
 
1646
+ ### protect
1647
+
1648
+ Mark a branch as protected, preventing it from being removed by `gw clean` (both interactive and auto modes) and auto-clean.
1649
+
1650
+ ```bash
1651
+ gw protect [branch]
1652
+ ```
1653
+
1654
+ If no branch is given, the current branch is auto-detected from the working directory.
1655
+
1656
+ The protected branch list is stored in `protectedBranches` inside `.gw/config.json` and is safe to commit to your repository.
1657
+
1658
+ > **Note:** The `defaultBranch`, `main`, `master`, and `gw_root` are always system-protected regardless of this setting. Use `gw protect` only for additional branches you want to keep around long-term (e.g. `staging`, `release/*`).
1659
+
1660
+ <a name="examples-protect"></a>
1661
+
1662
+ **Examples:**
1663
+
1664
+ ```bash
1665
+ # Protect the current branch
1666
+ gw protect
1667
+
1668
+ # Protect a specific branch
1669
+ gw protect staging
1670
+
1671
+ # Protect a release branch
1672
+ gw protect release/v2
1673
+ ```
1674
+
1675
+ ### unprotect
1676
+
1677
+ Remove a branch from the `protectedBranches` list, allowing `gw clean` and auto-clean to remove it again.
1678
+
1679
+ ```bash
1680
+ gw unprotect [branch]
1681
+ ```
1682
+
1683
+ If no branch is given, the current branch is auto-detected from the working directory.
1684
+
1685
+ <a name="examples-unprotect"></a>
1686
+
1687
+ **Examples:**
1688
+
1689
+ ```bash
1690
+ # Unprotect the current branch
1691
+ gw unprotect
1692
+
1693
+ # Unprotect a specific branch
1694
+ gw unprotect staging
1695
+ ```
1696
+
1639
1697
  #### lock
1640
1698
 
1641
1699
  Lock a worktree to prevent removal.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gw-tools/gw",
3
- "version": "0.63.0",
3
+ "version": "0.64.0-beta.75.1",
4
4
  "description": "A command-line tool for managing git worktrees - copy files between worktrees with ease",
5
5
  "keywords": [
6
6
  "git",