Skip to content

Instantly share code, notes, and snippets.

@antlis
Created April 16, 2026 19:52
Show Gist options
  • Select an option

  • Save antlis/a956b3321602d5bc7ad3cdb54aa0c198 to your computer and use it in GitHub Desktop.

Select an option

Save antlis/a956b3321602d5bc7ad3cdb54aa0c198 to your computer and use it in GitHub Desktop.
A small shell utility for interactively switching between Git worktrees using fzf. It displays available worktrees, allows fuzzy selection, and checks out the corresponding branch instantly. Ideal for workflows that rely heavily on git worktree.
wtf() {
local selected
selected=$(wt list | fzf --ansi --header "Select worktree" --header-lines=1)
if [[ -n "$selected" ]]; then
local branch
branch=$(echo "$selected" | awk '{print $2}')
wt switch "$branch"
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment