$local:workTree = git worktree list --porcelain | Select-String worktree | ForEach-Object { $_ -split 'worktree ' } | Where-Object { $_ } Edit-TextFile $(Join-Path $workTree .gitignore)