git-worktrees 0.10.0__tar.gz → 0.11.0__tar.gz
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.
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/AGENTS.md +39 -15
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/CHANGELOG.md +64 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/PKG-INFO +75 -47
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/README.md +74 -46
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/completions/gw.fish +6 -5
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/conf.d/worktrees.fish +1 -1
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/docs/REFERENCE.md +52 -23
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/docs/commands/branch-prune.md +8 -5
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/docs/commands/branch-status.md +16 -10
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/docs/commands/fast-forward.md +20 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/plugin/.claude-plugin/plugin.json +2 -2
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/plugin/.codex-plugin/plugin.json +4 -4
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/plugin/README.md +23 -6
- git_worktrees-0.11.0/plugin/hooks/codex.json +16 -0
- git_worktrees-0.11.0/plugin/hooks/hooks.json +16 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/plugin/plugin.json +2 -2
- git_worktrees-0.11.0/plugin/session.md +32 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/plugin/skills/prune/SKILL.md +30 -25
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/plugin/skills/ship-it/SKILL.md +26 -22
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/pyproject.toml +1 -1
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/src/worktrees/branch_cli.py +9 -9
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/src/worktrees/branches.py +90 -24
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/src/worktrees/cli.py +145 -75
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/src/worktrees/fast_forward.py +13 -6
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/src/worktrees/merged.py +146 -10
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/src/worktrees/new_branch.py +40 -10
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/src/worktrees/prune.py +133 -31
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/src/worktrees/render.py +1 -1
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/src/worktrees/verdicts.py +126 -50
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/src/worktrees/worktree.py +3 -5
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/tests/conftest.py +7 -1
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/tests/test_assessment.py +197 -41
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/tests/test_branch_forge.py +22 -1
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/tests/test_branches.py +7 -4
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/tests/test_cli.py +155 -86
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/tests/test_completions.py +18 -18
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/tests/test_fast_forward.py +8 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/tests/test_forge.py +10 -9
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/tests/test_gates.py +33 -38
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/tests/test_new_branch.py +153 -2
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/tests/test_partial_clone.py +11 -8
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/tests/test_plugin.py +63 -25
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/tests/test_removal.py +19 -22
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/tests/test_sync.py +19 -10
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/tests/test_worktree.py +40 -44
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/uv.lock +1 -1
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/zsh/plugins/worktrees/completions/_gw +6 -5
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/zsh/plugins/worktrees/worktrees.plugin.zsh +1 -1
- git_worktrees-0.10.0/plugin/skills/new-branch/SKILL.md +0 -51
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/.claude/settings.json +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/.codex/config.toml +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/.github/workflows/codeql.yml +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/.github/workflows/publish.yml +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/.github/workflows/testpypi.yml +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/.github/workflows/tests.yml +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/.gitignore +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/.pre-commit-config.yaml +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/.python-version +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/.releasetools.yaml +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/LICENSE +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/Makefile +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/completions/worktrees.fish +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/docs/BENCHMARK.md +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/docs/DEVELOPMENT.md +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/docs/commands/ci-checks.md +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/docs/commands/merge.md +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/docs/plans/2026-11-05-worktree-pruning-design.md +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/functions/gw.fish +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/functions/gwa.fish +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/functions/gwbc.fish +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/functions/gwbp.fish +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/functions/gwbs.fish +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/functions/gwff.fish +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/functions/gwl.fish +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/functions/gwm.fish +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/functions/gwp!.fish +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/functions/gwp.fish +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/functions/gwpa!.fish +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/functions/gwpa.fish +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/functions/gwr!.fish +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/functions/gwr.fish +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/functions/gws.fish +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/hatch_build.py +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/plugin/skills/ci-checks/SKILL.md +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/plugin/skills/describe-pr/SKILL.md +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/plugin/skills/describe-pr/format.md +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/plugin/skills/fast-forward/SKILL.md +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/plugin/skills/preflight/SKILL.md +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/plugin/skills/preflight/agents/openai.yaml +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/plugin/skills/preflight/rules.json +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/plugin/skills/ship-it/rights.md +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/renovate.json +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/scripts/README.md +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/scripts/benchmark.py +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/scripts/bump_version.py +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/scripts/verify-publish.bash +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/src/worktrees/__init__.py +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/src/worktrees/branch_forge.py +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/src/worktrees/ci.py +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/src/worktrees/errors.py +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/src/worktrees/forge.py +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/src/worktrees/git.py +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/src/worktrees/layout.py +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/src/worktrees/pick.py +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/src/worktrees/pr_merge.py +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/src/worktrees/progress.py +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/src/worktrees/repo.py +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/src/worktrees/sync.py +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/tests/test_benchmark.py +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/tests/test_ci.py +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/tests/test_command_defaults.py +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/tests/test_fixture.py +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/tests/test_git_records.py +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/tests/test_path_boundaries.py +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/tests/test_pr_merge.py +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/tests/test_render.py +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/tests/test_shims.py +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/tests/test_spec.py +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/tests/test_version.py +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/zsh/plugins/worktrees/functions/gw +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/zsh/plugins/worktrees/functions/gwa +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/zsh/plugins/worktrees/functions/gwbc +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/zsh/plugins/worktrees/functions/gwbp +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/zsh/plugins/worktrees/functions/gwbs +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/zsh/plugins/worktrees/functions/gwff +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/zsh/plugins/worktrees/functions/gwl +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/zsh/plugins/worktrees/functions/gwm +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/zsh/plugins/worktrees/functions/gwp +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/zsh/plugins/worktrees/functions/gwp! +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/zsh/plugins/worktrees/functions/gwpa +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/zsh/plugins/worktrees/functions/gwpa! +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/zsh/plugins/worktrees/functions/gwr +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/zsh/plugins/worktrees/functions/gwr! +0 -0
- {git_worktrees-0.10.0 → git_worktrees-0.11.0}/zsh/plugins/worktrees/functions/gws +0 -0
|
@@ -86,7 +86,11 @@ of the line alone, so no shortcut meets history expansion. `!!` would.
|
|
|
86
86
|
`gw branch create` and `gw fast-forward` start branches, not worktrees.
|
|
87
87
|
`gw branch create NAME` starts NAME off the head ref, as `origin new-branch`
|
|
88
88
|
does, and keeps argparse's 2 for a usage error where `origin` has a single
|
|
89
|
-
non-zero exit code.
|
|
89
|
+
non-zero exit code. On a terminal, standing on a branch other than the head
|
|
90
|
+
branch, it asks whether to stack NAME on that branch, and the sync it runs
|
|
91
|
+
first runs on a thread meanwhile: `_refresh` starts the spinner only once
|
|
92
|
+
the answer is in, so nothing draws over the question. `--here` starts NAME
|
|
93
|
+
from the commit this checkout is on and syncs nothing.
|
|
90
94
|
|
|
91
95
|
`gw fast-forward` starts a branch only when the one you stand on is proved
|
|
92
96
|
finished, by the same `merged.branch_proof` that `gw prune` reads, or when
|
|
@@ -187,14 +191,13 @@ watching. A shortcut has no completion file of its own.
|
|
|
187
191
|
|
|
188
192
|
## The agent plugin reads `--json`
|
|
189
193
|
|
|
190
|
-
`plugin/` ships with the CLI:
|
|
194
|
+
`plugin/` ships with the CLI: six skills, each a directory under
|
|
191
195
|
`plugin/skills/` named as its command is, `/worktrees:<name>` in Claude Code
|
|
192
196
|
and `$worktrees:<name>` in Codex. Skills call `gw` from `$PATH`; nothing
|
|
193
197
|
assumes a plugin root or a checkout at a known path.
|
|
194
198
|
|
|
195
199
|
| skill | runs |
|
|
196
200
|
| --- | --- |
|
|
197
|
-
| `new-branch` | `gw sync`, then `gw branch create` |
|
|
198
201
|
| `fast-forward` | `gw fast-forward --autostash --json`, then each rebase conflict until the branch is level |
|
|
199
202
|
| `ci-checks` | `gw ci-checks --json`, `--wait` to wait without polling |
|
|
200
203
|
| `describe-pr` | checks a review's title and body against its diff, and edits them |
|
|
@@ -224,8 +227,8 @@ skill's commands to never writing `--force`, `--admin`, `--auto` or
|
|
|
224
227
|
`--delete-branch`.
|
|
225
228
|
|
|
226
229
|
The prune skill reads `gw prune --json` and
|
|
227
|
-
`gw branch status --json`, preserving head/sync state and full rows for eligible, empty
|
|
228
|
-
stash-blocked and ignored
|
|
230
|
+
`gw branch status --json`, preserving head/sync state and full rows for eligible, empty
|
|
231
|
+
and stash-blocked cases, and each worktree's ignored paths. `tests/test_plugin.py` extracts the
|
|
229
232
|
actual jq filters and applies them to real CLI output. Checked-out branches
|
|
230
233
|
are absent from the loose-branch list. Paths and restore commands must retain
|
|
231
234
|
exact quoting.
|
|
@@ -239,6 +242,14 @@ and explicit deletion categories. Each worktree goes through
|
|
|
239
242
|
branches through `command gw branch prune`. The plugin never targets its current checkout. It reports
|
|
240
243
|
partial checkout, branch and stash outcomes and actual restore commands.
|
|
241
244
|
|
|
245
|
+
Both clients hand each session `plugin/session.md` when it starts: a
|
|
246
|
+
`SessionStart` hook in `plugin/hooks/hooks.json` for Claude Code and
|
|
247
|
+
`plugin/hooks/codex.json`, which the Codex manifest names, wraps the file
|
|
248
|
+
in the `additionalContext` JSON with `jq`. The rules say how a session uses
|
|
249
|
+
its worktree, including the check it makes before editing: changes it did
|
|
250
|
+
not make, or another process's lock, mean another session works there.
|
|
251
|
+
Nothing locks a worktree for a session.
|
|
252
|
+
|
|
242
253
|
The plugin carries the release version in three manifests, and
|
|
243
254
|
`scripts/bump_version.py` stamps all three. `plugin/plugin.json` is the
|
|
244
255
|
portable manifest, the Claude one with only the fields Agent Plugins v1 names;
|
|
@@ -586,11 +597,20 @@ and asserts it.
|
|
|
586
597
|
## Verdicts and deletion are separate
|
|
587
598
|
|
|
588
599
|
`merged.branch_proof` checks matching cached forge proof, first-parent
|
|
589
|
-
membership, local completion proof,
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
600
|
+
membership, local completion proof, absent evidence, the cached request's
|
|
601
|
+
state, then whether a remote-tracking ref holds the tip. It returns a reason:
|
|
602
|
+
`merged`, `unused`, `closed`, `open`, `pushed`, `unpushed` or `unknown`.
|
|
603
|
+
`gw fast-forward` reads it as it is; prune's assessments split `unused` by
|
|
604
|
+
the branch's reflog into `merged`, `unused` and `stale`, and put the
|
|
605
|
+
checkout facts first, `uncommitted` among them. A row's verdict is `remove`
|
|
606
|
+
for `merged` and `stale` and `keep` for every other reason. First-parent
|
|
607
|
+
history belongs to the assessed head, not a divergent local counterpart.
|
|
608
|
+
|
|
609
|
+
Removing a worktree deletes its HEAD reflog and deleting a branch its
|
|
610
|
+
reflog. `merged.reflog_only` lists the commits only those reach, by
|
|
611
|
+
`rev-list --not --all`, and keeps each whose own patch-id the head lacks;
|
|
612
|
+
they hold the row back until `--delete reflog`, which `--delete all`
|
|
613
|
+
includes and which is the one value `--keep-branch` takes.
|
|
594
614
|
|
|
595
615
|
Content proof compares changed paths, modes and deletions against the head.
|
|
596
616
|
It cannot settle a stacked branch whose intermediate content the head later
|
|
@@ -605,12 +625,16 @@ unmerged requests are never proof.
|
|
|
605
625
|
head branch are protected. Locked or dirty worktrees, untracked files,
|
|
606
626
|
initialized submodules and a submodule store left by `deinit` block removal;
|
|
607
627
|
`git worktree remove` refuses each. A locked worktree whose directory is away
|
|
608
|
-
is assessed from its record.
|
|
609
|
-
|
|
628
|
+
is assessed from its record. Empty branches and matching stashes require
|
|
629
|
+
their own permission; ignored paths go with the worktree, listed in the
|
|
630
|
+
disclosure first. `--yes` grants neither. A protection a value lifts ends
|
|
631
|
+
with every value its row needs, and only when those values make the row
|
|
632
|
+
eligible, so one hint followed alone frees it; the prune skill's jq reads
|
|
633
|
+
that wording, and `tests/test_plugin.py` runs it.
|
|
610
634
|
`gw prune` also protects the current worktree; `gw remove` needs a second terminal
|
|
611
635
|
confirmation for it. `--keep-branch` retains the branch and its stashes,
|
|
612
|
-
needs no completion proof for an attached checkout, and combines
|
|
613
|
-
`--delete
|
|
636
|
+
needs no completion proof for an attached checkout, and combines with no
|
|
637
|
+
`--delete` value.
|
|
614
638
|
|
|
615
639
|
The removal snapshot pins the branch and head SHAs, exact path, ignored
|
|
616
640
|
paths and stash identities. Recheck after confirmation precedes plain
|
|
@@ -618,7 +642,7 @@ worktree removal, full-SHA ref deletion and approved stash drops. Ignored
|
|
|
618
642
|
paths are what an ignore pattern names, so a matched directory is one entry;
|
|
619
643
|
the snapshot is a path listing, not a recursive content fingerprint, and a
|
|
620
644
|
file created inside a listed directory after assessment goes with it. The
|
|
621
|
-
disclosure
|
|
645
|
+
disclosure and the JSON `ignored` field list each
|
|
622
646
|
path as git does, from the top level, sorted, so a tracked directory above
|
|
623
647
|
an ignored one never reads as ignored. A path whose pattern, found with
|
|
624
648
|
`git check-ignore -v`, ends in a bare `*` or `**` reads as its directory,
|
|
@@ -17,6 +17,70 @@ not in here, whatever it cost to build.
|
|
|
17
17
|
A release closes with a `### Choices` section when a decision in it is worth
|
|
18
18
|
the reader's time: what was chosen, and what the alternative failed to do.
|
|
19
19
|
|
|
20
|
+
## 0.11.0 - 2026-11-14
|
|
21
|
+
|
|
22
|
+
### Changed
|
|
23
|
+
|
|
24
|
+
`gw prune`, `gw remove` and `gw branch status` give each row a verdict of
|
|
25
|
+
`remove` or `keep` and a reason naming the fact that decides it, such as
|
|
26
|
+
`merged`, `uncommitted`, `closed`, `unpushed` or `in-progress`, in a new
|
|
27
|
+
REASON column and as `reason` and `needs` in the JSON. Scripts that read
|
|
28
|
+
the `empty` or `unknown` verdicts, or pass `--only empty` or
|
|
29
|
+
`--only unknown`, must read `reason` instead; `--only` takes `remove` or
|
|
30
|
+
`keep`.
|
|
31
|
+
|
|
32
|
+
A worktree with uncommitted changes or untracked files reads `keep`. A
|
|
33
|
+
branch whose own commits went into the head branch by fast-forward reads
|
|
34
|
+
`merged`, and one with nothing of its own and no reflog left reads `stale`;
|
|
35
|
+
both are removed without `--delete empty`. Removal holds back a row whose
|
|
36
|
+
deleted reflogs hold a commit the head branch lacks, printing `git show`
|
|
37
|
+
for each, until `--delete reflog`. A branch whose pull request closed
|
|
38
|
+
without merging is kept until `--delete closed`.
|
|
39
|
+
|
|
40
|
+
A `pass --delete` hint appears only where those values free the row, and
|
|
41
|
+
the `--yes` command a preview prints keeps the flags that made the row
|
|
42
|
+
eligible; following either used to leave the row where it was. The
|
|
43
|
+
confirmation lists each worktree, ignored path, reflog commit, branch and
|
|
44
|
+
stash it deletes, and asks with their counts.
|
|
45
|
+
|
|
46
|
+
`gw prune` and `gw remove` delete a worktree's ignored files without a
|
|
47
|
+
permission, listing each ignored path before the confirmation. Drop
|
|
48
|
+
`--delete ignored-files` from scripts: it is now a usage error, and
|
|
49
|
+
`--keep-branch` takes no `--delete` value.
|
|
50
|
+
|
|
51
|
+
### Removed
|
|
52
|
+
|
|
53
|
+
The agent plugin's `new-branch` skill is removed; agents start branches
|
|
54
|
+
with `gw branch create` or `git switch --create`.
|
|
55
|
+
|
|
56
|
+
### Added
|
|
57
|
+
|
|
58
|
+
`gw branch create NAME`, on a terminal and standing on a branch other
|
|
59
|
+
than the head branch, asks whether to stack NAME on that branch while
|
|
60
|
+
its sync runs. `--here` starts NAME from the commit this checkout is
|
|
61
|
+
on without syncing.
|
|
62
|
+
|
|
63
|
+
The agent plugin hands each Claude Code and Codex session the rules for
|
|
64
|
+
how it uses its worktree, through a SessionStart hook that needs `jq`.
|
|
65
|
+
Before editing, a session checks whether another one works in its
|
|
66
|
+
worktree, from uncommitted changes it did not make or another process's
|
|
67
|
+
lock, and moves to a worktree of its own when one does. The rules say to
|
|
68
|
+
ship a change the user decided on once its checks pass, through
|
|
69
|
+
`/worktrees:ship-it`, without being asked, merge included.
|
|
70
|
+
|
|
71
|
+
### Fixed
|
|
72
|
+
|
|
73
|
+
`gw add`, `gw branch create` and `gw fast-forward NAME` refuse a branch
|
|
74
|
+
name that nests with an existing branch, such as `codex` beside
|
|
75
|
+
`codex/plan`, and name the branch in the way. Git's own refusal named
|
|
76
|
+
refs and lock files, and `gw add` left an empty directory behind.
|
|
77
|
+
|
|
78
|
+
`/worktrees:ship-it BRANCH ...` ships each named branch from the
|
|
79
|
+
worktree you run it in, switching to each in turn, and creates no
|
|
80
|
+
worktree. A branch checked out in another worktree is reported and
|
|
81
|
+
left alone. In the main checkout, ship-it switches back to the head
|
|
82
|
+
branch after each push.
|
|
83
|
+
|
|
20
84
|
## 0.10.0 - 2026-11-13
|
|
21
85
|
|
|
22
86
|
### Added
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: git-worktrees
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.11.0
|
|
4
4
|
Summary: Git worktree commands that refuse to lose work.
|
|
5
5
|
Project-URL: Bug reports, https://github.com/MihaiBojin/worktrees/issues/new
|
|
6
6
|
Project-URL: Source, https://github.com/MihaiBojin/worktrees
|
|
@@ -58,7 +58,7 @@ repositories under the same worktree root are outside their scope.
|
|
|
58
58
|
| `gw branch status [NAME ...]` | `gwbs` | assess local branches without worktrees |
|
|
59
59
|
| `gw branch prune [NAME ...]` | `gwbp` | confirm and delete eligible loose branches |
|
|
60
60
|
| `gw add NAME [BASE]` | `gwa` | create or enter a worktree |
|
|
61
|
-
| `gw branch create NAME` | `gwbc` | start a branch from the
|
|
61
|
+
| `gw branch create NAME` | `gwbc` | start a branch from the head ref, or stack it on this branch |
|
|
62
62
|
| `gw fast-forward [NAME]` | `gwff` | rebase this branch onto the head ref, or move a merged one, and what came after its merge, to a new branch |
|
|
63
63
|
| `gw merge NUMBER --match-head-commit SHA` | | squash one checked GitHub PR, respecting native stacks and merge queues |
|
|
64
64
|
| `gw ci-checks [NUMBER]` | | read a pull request's checks from GitHub or GitLab; `gw ci` for short |
|
|
@@ -104,7 +104,7 @@ the plugin's tag to the same release, as each manager below describes.
|
|
|
104
104
|
### fish
|
|
105
105
|
|
|
106
106
|
```console
|
|
107
|
-
fisher install MihaiBojin/worktrees@v0.
|
|
107
|
+
fisher install MihaiBojin/worktrees@v0.11.0
|
|
108
108
|
```
|
|
109
109
|
|
|
110
110
|
Fisher copies `functions/`, `completions/` and `conf.d/` from the repository
|
|
@@ -121,7 +121,7 @@ the untagged one holds the files.
|
|
|
121
121
|
Antidote takes a `path:` into the repository, and `branch:` takes a tag:
|
|
122
122
|
|
|
123
123
|
```
|
|
124
|
-
MihaiBojin/worktrees branch:v0.
|
|
124
|
+
MihaiBojin/worktrees branch:v0.11.0 path:zsh/plugins/worktrees # in zsh_plugins.txt
|
|
125
125
|
```
|
|
126
126
|
|
|
127
127
|
The plugin puts its own `functions/` and `completions/` on `fpath` and
|
|
@@ -196,8 +196,8 @@ its stdout stays the version alone for a script to read.
|
|
|
196
196
|
An excerpt of `gw --help`'s release lines with matching CLI and shell releases:
|
|
197
197
|
|
|
198
198
|
```console
|
|
199
|
-
worktrees 0.
|
|
200
|
-
The shell plugin here is 0.
|
|
199
|
+
worktrees 0.11.0: git worktree commands that refuse to lose work
|
|
200
|
+
The shell plugin here is 0.11.0, the same release as these commands.
|
|
201
201
|
```
|
|
202
202
|
|
|
203
203
|
A shell without the variable has no plugin loaded, or one older than the
|
|
@@ -246,20 +246,38 @@ A checked-out branch appears only as its worktree, never as a loose branch.
|
|
|
246
246
|
[Branch status](docs/commands/branch-status.md) describes the proofs;
|
|
247
247
|
[branch prune](docs/commands/branch-prune.md) covers selection and recovery.
|
|
248
248
|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
|
253
|
-
|
|
|
254
|
-
| `
|
|
255
|
-
|
|
256
|
-
`
|
|
257
|
-
|
|
258
|
-
`
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
249
|
+
A row's verdict is `remove` or `keep`, and its `reason` names the fact that
|
|
250
|
+
decides it, the first in this table that applies:
|
|
251
|
+
|
|
252
|
+
| Reason | Verdict | When |
|
|
253
|
+
| --- | --- | --- |
|
|
254
|
+
| `main-checkout` | `keep` | it is the main checkout |
|
|
255
|
+
| `current` | `keep` | `gw prune` runs inside it |
|
|
256
|
+
| `locked` | `keep` | the worktree is locked |
|
|
257
|
+
| `missing` | `keep` | its directory is gone and its record locked |
|
|
258
|
+
| `submodule` | `keep` | it has an initialized submodule or a submodule store |
|
|
259
|
+
| `in-progress` | `keep` | a rebase, merge, cherry-pick, revert or bisect waits in it |
|
|
260
|
+
| `uncommitted` | `keep` | it has uncommitted changes or untracked files |
|
|
261
|
+
| `protected` | `keep` | its branch is `main`, `master` or the head branch |
|
|
262
|
+
| `merged` | `remove` | a matching cached merged request, local ancestry, squash or content proof, or commits made on the branch that now sit on the head ref's first-parent history |
|
|
263
|
+
| `closed` | `keep` | a request closed unmerged at this tip; `--delete closed` removes it |
|
|
264
|
+
| `open` | `keep` | a request open at this tip |
|
|
265
|
+
| `unused` | `keep` | the tip is on the head ref's first-parent history and its reflog records no commit made on it; `--delete empty` removes it |
|
|
266
|
+
| `stale` | `remove` | the same, with no reflog left to say whether it was used |
|
|
267
|
+
| `pushed` | `keep` | commits outside the head that a remote-tracking ref holds |
|
|
268
|
+
| `unpushed` | `keep` | commits outside the head that only this repository holds |
|
|
269
|
+
| `unknown` | `keep` | the CLI lacks valid evidence |
|
|
270
|
+
|
|
271
|
+
Deleting a branch deletes its reflog, and removing a worktree deletes the
|
|
272
|
+
worktree's own. A commit nothing else reaches goes with them, so a row whose
|
|
273
|
+
deleted reflogs hold a commit whose patch the head lacks is held back, and
|
|
274
|
+
the protection names `git show SHA` for each one. `eligible` also checks
|
|
275
|
+
protections and the deletion permissions you supplied. The WHY column gives
|
|
276
|
+
the evidence, then each protection that stands. A protection that `--delete`
|
|
277
|
+
values lift ends with every value its row needs, such as
|
|
278
|
+
`pass --delete empty --delete stashes`, and only where those values make
|
|
279
|
+
the row eligible. For a target it keeps, `gw remove` prints every reason, and
|
|
280
|
+
names a command with `--keep-branch` when only that removes the worktree.
|
|
263
281
|
|
|
264
282
|
The CLI never deletes `main`, `master` or the head branch. It never removes
|
|
265
283
|
the main checkout, locked or dirty worktrees, worktrees with untracked files,
|
|
@@ -277,38 +295,44 @@ Repeat `--delete` to combine categories:
|
|
|
277
295
|
|
|
278
296
|
| Value | `gw prune`, `gw remove` | `gw branch prune` |
|
|
279
297
|
| --- | --- | --- |
|
|
280
|
-
| `empty` | permit an
|
|
281
|
-
| `ignored-files` | permit the worktree's ignored paths | usage error |
|
|
298
|
+
| `empty` | permit an `unused` branch and its worktree | permit an `unused` branch |
|
|
282
299
|
| `stashes` | permit the branch's stashes | same |
|
|
283
|
-
| `
|
|
300
|
+
| `closed` | permit a branch whose request closed unmerged at its tip | same |
|
|
301
|
+
| `reflog` | permit dropping commits only the deleted reflogs hold | same |
|
|
302
|
+
| `all` | every value above | same |
|
|
284
303
|
|
|
285
304
|
`gw branch status` rejects `--delete`. An unknown or unsupported value is a
|
|
286
|
-
usage error before mutation. `--delete
|
|
287
|
-
verdict.
|
|
288
|
-
contents. When only missing values hold worktrees back, `gw prune` names
|
|
305
|
+
usage error before mutation. A `--delete` value changes eligibility, not the
|
|
306
|
+
verdict. When only missing values hold worktrees back, `gw prune` names
|
|
289
307
|
the command that grants them, keeping the values you passed:
|
|
290
|
-
`gw prune --delete
|
|
308
|
+
`gw prune --delete empty makes fix-parser eligible`. Without a terminal,
|
|
309
|
+
the line that names `--yes` carries the `--delete` values and
|
|
310
|
+
`--keep-branch` you passed, so running it removes what was counted.
|
|
291
311
|
|
|
292
312
|
```console
|
|
293
|
-
gw prune --delete empty --delete
|
|
313
|
+
gw prune --delete empty --delete stashes
|
|
294
314
|
gw remove old-checkout --keep-branch
|
|
295
|
-
gw remove old-checkout --keep-branch --delete ignored-files
|
|
296
315
|
```
|
|
297
316
|
|
|
298
317
|
`--keep-branch` removes an otherwise unprotected checkout without completion
|
|
299
318
|
proof and retains its branch and stashes, including a protected branch.
|
|
300
319
|
A detached checkout has no branch to keep its commits, so it still needs
|
|
301
|
-
proof.
|
|
302
|
-
|
|
303
|
-
with it; `empty`, `stashes` and `all` are usage errors with `--keep-branch`.
|
|
320
|
+
proof. It keeps the branch's reflog but not the worktree's, so it takes
|
|
321
|
+
`--delete reflog`, and every other `--delete` value is a usage error with it.
|
|
304
322
|
|
|
305
323
|
### Removal and recovery
|
|
306
324
|
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
325
|
+
Removal deletes a worktree's ignored files: build output, caches and
|
|
326
|
+
virtual environments are what most of them are. They have no recovery
|
|
327
|
+
command, since Git never recorded their contents. Before confirmation, the
|
|
328
|
+
CLI discloses each thing it deletes or keeps, one line each, led by what
|
|
329
|
+
happens to it: `delete worktree` with its path, `delete ignored` for each
|
|
330
|
+
ignored path, sorted by name, `delete branch` and `delete stash` with their
|
|
331
|
+
restore commands, or `keep branch` under `--keep-branch`. The question
|
|
332
|
+
counts each kind: `delete 1 worktree, 1 ignored path and 1 branch? [y/N]`.
|
|
333
|
+
Each ignored path reads as the pattern that ignores it names it, from the
|
|
334
|
+
top level, with a trailing `/` on a directory: `__pycache__` lists
|
|
335
|
+
`src/pkg/__pycache__/`, never the tracked
|
|
312
336
|
`src/` above it. A pattern for a directory's contents, such as
|
|
313
337
|
`path/to/ignored/*`, lists that directory once as `path/to/ignored/`.
|
|
314
338
|
Below the list, `git -C PATH ls-files --others --ignored --exclude-standard`
|
|
@@ -353,10 +377,9 @@ JSON carries it in `path` and `outcome.destination`.
|
|
|
353
377
|
| `gwpa!` | `gw prune --delete all --yes` |
|
|
354
378
|
| `gwr!` | `gw remove --yes` |
|
|
355
379
|
|
|
356
|
-
`gwpa` permits deleting empty branches
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
`gw remove --delete ignored-files`.
|
|
380
|
+
`gwpa` permits deleting empty branches and branch stashes, and still asks
|
|
381
|
+
at a terminal. `gwpa!` and `gwr!` skip that question, as `gwp!` does.
|
|
382
|
+
`gwr!` grants no deletion category.
|
|
360
383
|
|
|
361
384
|
## Head and synchronization
|
|
362
385
|
|
|
@@ -546,8 +569,8 @@ parseable. Passing both is a usage error.
|
|
|
546
569
|
| `gw merge` | no | yes |
|
|
547
570
|
|
|
548
571
|
Other commands retain their own flags; use `--help`. Help, version and
|
|
549
|
-
completion work without an assessment. `--only` filters assessment verdicts
|
|
550
|
-
and can be repeated
|
|
572
|
+
completion work without an assessment. `--only` filters assessment verdicts,
|
|
573
|
+
`remove` or `keep`, and can be repeated.
|
|
551
574
|
|
|
552
575
|
Every JSON result is an object with `lastSync` and `head`:
|
|
553
576
|
|
|
@@ -582,14 +605,14 @@ gw list --json | jq -r '.worktrees[].path'
|
|
|
582
605
|
| `gwp --dry-run` | `gw prune --json` or `gw prune --table` |
|
|
583
606
|
| `gw list --list`, `gw list -l`, `gw prune --list` | `gw list --table`, `gw prune --table` |
|
|
584
607
|
| `gwp --branch NAME` | `gw remove NAME` or a quoted exact path |
|
|
585
|
-
| `--delete-ignored
|
|
608
|
+
| `--delete-ignored`, `--delete ignored-files` | none; removal deletes ignored files and lists them first |
|
|
586
609
|
| `gwr --force`, `gwr -f` | `gw remove --keep-branch` |
|
|
587
610
|
| `--no-fetch`, `--no-forge`, `--force-refresh`, refresh `-f` | `WORKTREES_OFFLINE=1` to stay offline; `gw sync` to refresh now |
|
|
588
611
|
| `gw ls`, `gw NAME` | `gw list`, `gw list NAME` |
|
|
589
612
|
| `gwh`, `gw help`, `gw h` | `gw --help` or `gw -h` |
|
|
590
613
|
| a `--json` listing as an array, `.[]` | `gw list --json` object, `.worktrees[]` |
|
|
591
614
|
|
|
592
|
-
`
|
|
615
|
+
An `unused` or `closed` row requires explicit permission. `main` and `master` always remain
|
|
593
616
|
protected. Update scripts that assume a `remove` verdict alone permits
|
|
594
617
|
deletion to check `eligible` too.
|
|
595
618
|
|
|
@@ -609,14 +632,19 @@ an update-ref delete that names no full sha
|
|
|
609
632
|
|
|
610
633
|
## Agent plugin
|
|
611
634
|
|
|
612
|
-
[The agent plugin](plugin/README.md) gives Claude Code and Codex
|
|
613
|
-
over these commands:
|
|
635
|
+
[The agent plugin](plugin/README.md) gives Claude Code and Codex six skills
|
|
636
|
+
over these commands: bring a branch level with the head
|
|
614
637
|
branch through its rebase conflicts, read CI, keep a pull request's
|
|
615
638
|
description true to its diff, ship a change or an open pull request
|
|
616
639
|
through CI to its merge, prune finished worktrees and branches after
|
|
617
640
|
asking, and add the permission rules shipping needs to Claude Code's
|
|
618
641
|
settings.
|
|
619
642
|
|
|
643
|
+
The skills handle branches, pull requests and merges in the checkout the
|
|
644
|
+
session runs in, and never create a worktree. Creating and choosing
|
|
645
|
+
worktrees is for a person, through `gw add` and `gw list`, or for the
|
|
646
|
+
agent's client, as `claude --worktree` and `codex --worktree` do.
|
|
647
|
+
|
|
620
648
|
## Contributing
|
|
621
649
|
|
|
622
650
|
See [DEVELOPMENT.md](docs/DEVELOPMENT.md) for checks and release commands,
|
|
@@ -31,7 +31,7 @@ repositories under the same worktree root are outside their scope.
|
|
|
31
31
|
| `gw branch status [NAME ...]` | `gwbs` | assess local branches without worktrees |
|
|
32
32
|
| `gw branch prune [NAME ...]` | `gwbp` | confirm and delete eligible loose branches |
|
|
33
33
|
| `gw add NAME [BASE]` | `gwa` | create or enter a worktree |
|
|
34
|
-
| `gw branch create NAME` | `gwbc` | start a branch from the
|
|
34
|
+
| `gw branch create NAME` | `gwbc` | start a branch from the head ref, or stack it on this branch |
|
|
35
35
|
| `gw fast-forward [NAME]` | `gwff` | rebase this branch onto the head ref, or move a merged one, and what came after its merge, to a new branch |
|
|
36
36
|
| `gw merge NUMBER --match-head-commit SHA` | | squash one checked GitHub PR, respecting native stacks and merge queues |
|
|
37
37
|
| `gw ci-checks [NUMBER]` | | read a pull request's checks from GitHub or GitLab; `gw ci` for short |
|
|
@@ -77,7 +77,7 @@ the plugin's tag to the same release, as each manager below describes.
|
|
|
77
77
|
### fish
|
|
78
78
|
|
|
79
79
|
```console
|
|
80
|
-
fisher install MihaiBojin/worktrees@v0.
|
|
80
|
+
fisher install MihaiBojin/worktrees@v0.11.0
|
|
81
81
|
```
|
|
82
82
|
|
|
83
83
|
Fisher copies `functions/`, `completions/` and `conf.d/` from the repository
|
|
@@ -94,7 +94,7 @@ the untagged one holds the files.
|
|
|
94
94
|
Antidote takes a `path:` into the repository, and `branch:` takes a tag:
|
|
95
95
|
|
|
96
96
|
```
|
|
97
|
-
MihaiBojin/worktrees branch:v0.
|
|
97
|
+
MihaiBojin/worktrees branch:v0.11.0 path:zsh/plugins/worktrees # in zsh_plugins.txt
|
|
98
98
|
```
|
|
99
99
|
|
|
100
100
|
The plugin puts its own `functions/` and `completions/` on `fpath` and
|
|
@@ -169,8 +169,8 @@ its stdout stays the version alone for a script to read.
|
|
|
169
169
|
An excerpt of `gw --help`'s release lines with matching CLI and shell releases:
|
|
170
170
|
|
|
171
171
|
```console
|
|
172
|
-
worktrees 0.
|
|
173
|
-
The shell plugin here is 0.
|
|
172
|
+
worktrees 0.11.0: git worktree commands that refuse to lose work
|
|
173
|
+
The shell plugin here is 0.11.0, the same release as these commands.
|
|
174
174
|
```
|
|
175
175
|
|
|
176
176
|
A shell without the variable has no plugin loaded, or one older than the
|
|
@@ -219,20 +219,38 @@ A checked-out branch appears only as its worktree, never as a loose branch.
|
|
|
219
219
|
[Branch status](docs/commands/branch-status.md) describes the proofs;
|
|
220
220
|
[branch prune](docs/commands/branch-prune.md) covers selection and recovery.
|
|
221
221
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
|
226
|
-
|
|
|
227
|
-
| `
|
|
228
|
-
|
|
229
|
-
`
|
|
230
|
-
|
|
231
|
-
`
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
222
|
+
A row's verdict is `remove` or `keep`, and its `reason` names the fact that
|
|
223
|
+
decides it, the first in this table that applies:
|
|
224
|
+
|
|
225
|
+
| Reason | Verdict | When |
|
|
226
|
+
| --- | --- | --- |
|
|
227
|
+
| `main-checkout` | `keep` | it is the main checkout |
|
|
228
|
+
| `current` | `keep` | `gw prune` runs inside it |
|
|
229
|
+
| `locked` | `keep` | the worktree is locked |
|
|
230
|
+
| `missing` | `keep` | its directory is gone and its record locked |
|
|
231
|
+
| `submodule` | `keep` | it has an initialized submodule or a submodule store |
|
|
232
|
+
| `in-progress` | `keep` | a rebase, merge, cherry-pick, revert or bisect waits in it |
|
|
233
|
+
| `uncommitted` | `keep` | it has uncommitted changes or untracked files |
|
|
234
|
+
| `protected` | `keep` | its branch is `main`, `master` or the head branch |
|
|
235
|
+
| `merged` | `remove` | a matching cached merged request, local ancestry, squash or content proof, or commits made on the branch that now sit on the head ref's first-parent history |
|
|
236
|
+
| `closed` | `keep` | a request closed unmerged at this tip; `--delete closed` removes it |
|
|
237
|
+
| `open` | `keep` | a request open at this tip |
|
|
238
|
+
| `unused` | `keep` | the tip is on the head ref's first-parent history and its reflog records no commit made on it; `--delete empty` removes it |
|
|
239
|
+
| `stale` | `remove` | the same, with no reflog left to say whether it was used |
|
|
240
|
+
| `pushed` | `keep` | commits outside the head that a remote-tracking ref holds |
|
|
241
|
+
| `unpushed` | `keep` | commits outside the head that only this repository holds |
|
|
242
|
+
| `unknown` | `keep` | the CLI lacks valid evidence |
|
|
243
|
+
|
|
244
|
+
Deleting a branch deletes its reflog, and removing a worktree deletes the
|
|
245
|
+
worktree's own. A commit nothing else reaches goes with them, so a row whose
|
|
246
|
+
deleted reflogs hold a commit whose patch the head lacks is held back, and
|
|
247
|
+
the protection names `git show SHA` for each one. `eligible` also checks
|
|
248
|
+
protections and the deletion permissions you supplied. The WHY column gives
|
|
249
|
+
the evidence, then each protection that stands. A protection that `--delete`
|
|
250
|
+
values lift ends with every value its row needs, such as
|
|
251
|
+
`pass --delete empty --delete stashes`, and only where those values make
|
|
252
|
+
the row eligible. For a target it keeps, `gw remove` prints every reason, and
|
|
253
|
+
names a command with `--keep-branch` when only that removes the worktree.
|
|
236
254
|
|
|
237
255
|
The CLI never deletes `main`, `master` or the head branch. It never removes
|
|
238
256
|
the main checkout, locked or dirty worktrees, worktrees with untracked files,
|
|
@@ -250,38 +268,44 @@ Repeat `--delete` to combine categories:
|
|
|
250
268
|
|
|
251
269
|
| Value | `gw prune`, `gw remove` | `gw branch prune` |
|
|
252
270
|
| --- | --- | --- |
|
|
253
|
-
| `empty` | permit an
|
|
254
|
-
| `ignored-files` | permit the worktree's ignored paths | usage error |
|
|
271
|
+
| `empty` | permit an `unused` branch and its worktree | permit an `unused` branch |
|
|
255
272
|
| `stashes` | permit the branch's stashes | same |
|
|
256
|
-
| `
|
|
273
|
+
| `closed` | permit a branch whose request closed unmerged at its tip | same |
|
|
274
|
+
| `reflog` | permit dropping commits only the deleted reflogs hold | same |
|
|
275
|
+
| `all` | every value above | same |
|
|
257
276
|
|
|
258
277
|
`gw branch status` rejects `--delete`. An unknown or unsupported value is a
|
|
259
|
-
usage error before mutation. `--delete
|
|
260
|
-
verdict.
|
|
261
|
-
contents. When only missing values hold worktrees back, `gw prune` names
|
|
278
|
+
usage error before mutation. A `--delete` value changes eligibility, not the
|
|
279
|
+
verdict. When only missing values hold worktrees back, `gw prune` names
|
|
262
280
|
the command that grants them, keeping the values you passed:
|
|
263
|
-
`gw prune --delete
|
|
281
|
+
`gw prune --delete empty makes fix-parser eligible`. Without a terminal,
|
|
282
|
+
the line that names `--yes` carries the `--delete` values and
|
|
283
|
+
`--keep-branch` you passed, so running it removes what was counted.
|
|
264
284
|
|
|
265
285
|
```console
|
|
266
|
-
gw prune --delete empty --delete
|
|
286
|
+
gw prune --delete empty --delete stashes
|
|
267
287
|
gw remove old-checkout --keep-branch
|
|
268
|
-
gw remove old-checkout --keep-branch --delete ignored-files
|
|
269
288
|
```
|
|
270
289
|
|
|
271
290
|
`--keep-branch` removes an otherwise unprotected checkout without completion
|
|
272
291
|
proof and retains its branch and stashes, including a protected branch.
|
|
273
292
|
A detached checkout has no branch to keep its commits, so it still needs
|
|
274
|
-
proof.
|
|
275
|
-
|
|
276
|
-
with it; `empty`, `stashes` and `all` are usage errors with `--keep-branch`.
|
|
293
|
+
proof. It keeps the branch's reflog but not the worktree's, so it takes
|
|
294
|
+
`--delete reflog`, and every other `--delete` value is a usage error with it.
|
|
277
295
|
|
|
278
296
|
### Removal and recovery
|
|
279
297
|
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
298
|
+
Removal deletes a worktree's ignored files: build output, caches and
|
|
299
|
+
virtual environments are what most of them are. They have no recovery
|
|
300
|
+
command, since Git never recorded their contents. Before confirmation, the
|
|
301
|
+
CLI discloses each thing it deletes or keeps, one line each, led by what
|
|
302
|
+
happens to it: `delete worktree` with its path, `delete ignored` for each
|
|
303
|
+
ignored path, sorted by name, `delete branch` and `delete stash` with their
|
|
304
|
+
restore commands, or `keep branch` under `--keep-branch`. The question
|
|
305
|
+
counts each kind: `delete 1 worktree, 1 ignored path and 1 branch? [y/N]`.
|
|
306
|
+
Each ignored path reads as the pattern that ignores it names it, from the
|
|
307
|
+
top level, with a trailing `/` on a directory: `__pycache__` lists
|
|
308
|
+
`src/pkg/__pycache__/`, never the tracked
|
|
285
309
|
`src/` above it. A pattern for a directory's contents, such as
|
|
286
310
|
`path/to/ignored/*`, lists that directory once as `path/to/ignored/`.
|
|
287
311
|
Below the list, `git -C PATH ls-files --others --ignored --exclude-standard`
|
|
@@ -326,10 +350,9 @@ JSON carries it in `path` and `outcome.destination`.
|
|
|
326
350
|
| `gwpa!` | `gw prune --delete all --yes` |
|
|
327
351
|
| `gwr!` | `gw remove --yes` |
|
|
328
352
|
|
|
329
|
-
`gwpa` permits deleting empty branches
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
`gw remove --delete ignored-files`.
|
|
353
|
+
`gwpa` permits deleting empty branches and branch stashes, and still asks
|
|
354
|
+
at a terminal. `gwpa!` and `gwr!` skip that question, as `gwp!` does.
|
|
355
|
+
`gwr!` grants no deletion category.
|
|
333
356
|
|
|
334
357
|
## Head and synchronization
|
|
335
358
|
|
|
@@ -519,8 +542,8 @@ parseable. Passing both is a usage error.
|
|
|
519
542
|
| `gw merge` | no | yes |
|
|
520
543
|
|
|
521
544
|
Other commands retain their own flags; use `--help`. Help, version and
|
|
522
|
-
completion work without an assessment. `--only` filters assessment verdicts
|
|
523
|
-
and can be repeated
|
|
545
|
+
completion work without an assessment. `--only` filters assessment verdicts,
|
|
546
|
+
`remove` or `keep`, and can be repeated.
|
|
524
547
|
|
|
525
548
|
Every JSON result is an object with `lastSync` and `head`:
|
|
526
549
|
|
|
@@ -555,14 +578,14 @@ gw list --json | jq -r '.worktrees[].path'
|
|
|
555
578
|
| `gwp --dry-run` | `gw prune --json` or `gw prune --table` |
|
|
556
579
|
| `gw list --list`, `gw list -l`, `gw prune --list` | `gw list --table`, `gw prune --table` |
|
|
557
580
|
| `gwp --branch NAME` | `gw remove NAME` or a quoted exact path |
|
|
558
|
-
| `--delete-ignored
|
|
581
|
+
| `--delete-ignored`, `--delete ignored-files` | none; removal deletes ignored files and lists them first |
|
|
559
582
|
| `gwr --force`, `gwr -f` | `gw remove --keep-branch` |
|
|
560
583
|
| `--no-fetch`, `--no-forge`, `--force-refresh`, refresh `-f` | `WORKTREES_OFFLINE=1` to stay offline; `gw sync` to refresh now |
|
|
561
584
|
| `gw ls`, `gw NAME` | `gw list`, `gw list NAME` |
|
|
562
585
|
| `gwh`, `gw help`, `gw h` | `gw --help` or `gw -h` |
|
|
563
586
|
| a `--json` listing as an array, `.[]` | `gw list --json` object, `.worktrees[]` |
|
|
564
587
|
|
|
565
|
-
`
|
|
588
|
+
An `unused` or `closed` row requires explicit permission. `main` and `master` always remain
|
|
566
589
|
protected. Update scripts that assume a `remove` verdict alone permits
|
|
567
590
|
deletion to check `eligible` too.
|
|
568
591
|
|
|
@@ -582,14 +605,19 @@ an update-ref delete that names no full sha
|
|
|
582
605
|
|
|
583
606
|
## Agent plugin
|
|
584
607
|
|
|
585
|
-
[The agent plugin](plugin/README.md) gives Claude Code and Codex
|
|
586
|
-
over these commands:
|
|
608
|
+
[The agent plugin](plugin/README.md) gives Claude Code and Codex six skills
|
|
609
|
+
over these commands: bring a branch level with the head
|
|
587
610
|
branch through its rebase conflicts, read CI, keep a pull request's
|
|
588
611
|
description true to its diff, ship a change or an open pull request
|
|
589
612
|
through CI to its merge, prune finished worktrees and branches after
|
|
590
613
|
asking, and add the permission rules shipping needs to Claude Code's
|
|
591
614
|
settings.
|
|
592
615
|
|
|
616
|
+
The skills handle branches, pull requests and merges in the checkout the
|
|
617
|
+
session runs in, and never create a worktree. Creating and choosing
|
|
618
|
+
worktrees is for a person, through `gw add` and `gw list`, or for the
|
|
619
|
+
agent's client, as `claude --worktree` and `codex --worktree` do.
|
|
620
|
+
|
|
593
621
|
## Contributing
|
|
594
622
|
|
|
595
623
|
See [DEVELOPMENT.md](docs/DEVELOPMENT.md) for checks and release commands,
|