Summary
Add support for moving an existing worktree to a new filesystem location. The worktree helpers can create, list, navigate to, and remove worktrees, but there is no command to relocate a worktree once it exists. Today the only path is to drop to raw git worktree move, which also leaves any derived path bookkeeping untouched.
Motivation
- Reorganizing worktrees on disk (e.g. conforming to a standard
<container>/<branch> layout, moving to a different drive, or renaming a directory) currently requires manual git worktree move plus manual cleanup.
- A first-class command keeps the operation consistent with the rest of the worktree helper surface (discoverable, tab-completable branch names,
-WhatIf/-Confirm, typed results).
Proposed capability
A cmdlet that moves a worktree identified by its branch (consistent with how the other worktree commands are addressed) to a caller-supplied destination path, wrapping git worktree move.
Suggested behavior:
- Accept the worktree to move by branch name (with tab-completion / validation from the current repo's worktrees) and a destination path.
- Support pipeline input by property name so a worktree object can be piped in, matching the other worktree cmdlets.
- Refuse to move the main/root worktree (git itself disallows this) with a clear error.
- Surface git's own guard rails (locked worktrees, destination already exists) as clear errors; optionally expose a
-Force switch that maps to git worktree move --force for the cases git allows it.
- Implement
[CmdletBinding(SupportsShouldProcess)] and honor -WhatIf/-Confirm, since this is a state-changing operation.
- Optionally offer a switch to
Set-Location into the new path after a successful move.
Acceptance criteria
Summary
Add support for moving an existing worktree to a new filesystem location. The worktree helpers can create, list, navigate to, and remove worktrees, but there is no command to relocate a worktree once it exists. Today the only path is to drop to raw
git worktree move, which also leaves any derived path bookkeeping untouched.Motivation
<container>/<branch>layout, moving to a different drive, or renaming a directory) currently requires manualgit worktree moveplus manual cleanup.-WhatIf/-Confirm, typed results).Proposed capability
A cmdlet that moves a worktree identified by its branch (consistent with how the other worktree commands are addressed) to a caller-supplied destination path, wrapping
git worktree move.Suggested behavior:
-Forceswitch that maps togit worktree move --forcefor the cases git allows it.[CmdletBinding(SupportsShouldProcess)]and honor-WhatIf/-Confirm, since this is a state-changing operation.Set-Locationinto the new path after a successful move.Acceptance criteria
-WhatIfand-Confirmand performs no move under-WhatIf.[Unreleased]) entry.