Lock a Git Worktree
Locking a worktree is a built-in Git protection mechanism that prevents accidental deletion, renaming, relocating, or pruning of critical working directories. WorktreeWise provides an intuitive interface to apply and annotate worktree locks with descriptive human-readable reasons.
When to Lock a Worktree
Consider locking a worktree in scenarios such as:
- Long-running background tasks: When a worktree is actively compiling a large build, running an extended test matrix, or executing a long-running benchmark.
- Detached or network storage: When a worktree resides on a network share or removable drive that might temporarily disconnect (preventing
git worktree prunefrom deleting it while offline). - Staging & release verification: When an environment must remain strictly unchanged while waiting for QA or deployment sign-off.
- Experimental spikes: When preserving uncommitted exploratory work that you do not want touched during routine repository maintenance.
How to Lock a Worktree
- Open the Worktrees panel and locate the worktree you want to safeguard.
- Click the three-dot Actions button.
- Select Lock.

- In the dialog, enter a clear, descriptive Reason (for example,
Preserving release candidate v1.1.0-rc2 for staging smoke tests). - Click Lock.

After confirmation, a lock indicator appears beside the worktree in the sidebar.

Protection Guarantees
Once a worktree is locked:
| Operation | Status When Locked | Protection Guarantee |
|---|---|---|
| Delete | Disabled | Cannot be deleted via the UI or accidental CLI command |
| Rename | Disabled | Worktree folder and branch name cannot be modified |
| Move | Disabled | Directory path cannot be relocated |
| Prune | Ignored | Git and WorktreeWise prune operations completely skip locked entries, even if the folder is temporarily unmounted |
Visual Status Indicators
- A Lock icon (🔒) appears next to the worktree name in the left navigation sidebar.
- In the Worktree Overview, the worktree receives a distinct
Lockedtag in its Health summary section, showing the recorded lock reason.