Branches (1)

main (default)

66cd038 fix(init): preserve untracked/ignored files

Click to expand commit body
Previously, wt init would delete globally-ignored and untracked files
from the project root after creating the worktree. Since git worktree
add only creates tracked files, these files were permanently lost.

Now wt init:
- Uses git status --porcelain=v1 -z --ignored=matching to detect all
file states
- Aborts only on tracked modifications (staged/unstaged changes)
- Copies untracked and ignored files to the worktree before cleanup
- Checks for destination conflicts to prevent overwriting tracked files
- Properly quotes all shell arguments to handle special characters

Assisted-by: Claude Opus 4.5 via Amp

Amolith created