Skip to content

Instantly share code, notes, and snippets.

@phaalonso
Created July 17, 2024 16:17
Show Gist options
  • Save phaalonso/b39de126c70dce49ed82b17178483d93 to your computer and use it in GitHub Desktop.
Save phaalonso/b39de126c70dce49ed82b17178483d93 to your computer and use it in GitHub Desktop.
Powershell - cd in git repository chosen with fzf
$projects = 'project dir' (must end with an \ )
function gitRepo {
fd '.git' -H -t d --prune --exclude target --exclude src --exclude logs --exclude node_modules --base-directory $projects | ForEach-Object { $_ -replace '\.git\\','' } | fzf | ForEach-Object { -join($projects, $_) } | cd
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment